Jump to content
  • 0

How to make an animated weapon pickup?


Szuran

Question

What should I do to make a weapon pickup / ammo sprite animate on the ground?

 

Instead of rocket launcher, I want the player to pick up a soul.

 

SoulSmall.png.c0dc63a99d954a3b8388c789a8fec2ab.png

 

That's simple enough, just a file swap. But that doesn't look too good when it's not moving, so I want to add two additional animation frames, so it look like this:

 

SoulSmall.png.05b4a51045ef77ad756222881c5c2a31.pngROCKB0.png.84656357a806d3cd648fd3453addb5f2.pngROCKC0.png.5700d9fc7f11c64655349aa3bda9b411.png

 

I tried to dabble with Decorate but to no effect.

 

I named my sprites ROCKA0, ROCKB0 and ROCKC0. But how to make them move?

Edited by Szuran

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 0

For ZDoom compatibility it'll be relatively simple:

Actor SoulRocket : Ammo replaces RocketAmmo
{
	// Insert here whatever properties are relevant to your project
	States
	{
	Spawn:
		ROCK ABC 5
		Loop
	}
}

You can change the speed of the animation by using another value than 5. It's in tic so there are 35 of them by second, by using a length of 5 it means each frame shows for 5/35th (or 1/7th if you prefer) of a second. Smaller value gives faster animation, larger value gives slower animation. Do not use 0.

 

For more general compatibility, you'll need to deal with DeHackEd. That means you'll have to take two frames from somewhere else (it's not a problem, there are a few unused frames you can recycle like the gray stalagmite or the second gibbed marine) and change their sprites to ROCK and their frame numbers to 1 and 2 (0 is A, 1 is B, 2 is C, etc.) and then create a looping cycle by having the regular rocket pickup frame lead to your modified B state, which itself leads to the modified C state, which itself leads back to the normal A.

Share this post


Link to post
  • 0

You have to write the frame loop in the Spawn state. Like so:

Spawn:
      ROCK ABC 5
      Loop

This means display frame A, B then C of ROCK each with 5 tics. You may want less or more tics depending on how fast you want the animation to be.

Edited by Nevander

Share this post


Link to post
  • 0

DON'T MIND THIS POST, I"VE FOUND A SOLUTION AND IT WAS OBVIOUS. THANK YOU.

 

Old post:

Hmm, this ZDoom solution doesn't seem to be working, the code should be fine. I tried to swap both the Rocket Launcher and Rocket Ammo. The weapons work as intended, but only the rocket launcher pickup is moving, not the ammo pickup. Could you review the code?

 

Quote

ACTOR Boomsnap : RocketLauncher replaces RocketLauncher 2500
{
 Weapon.AmmoType "RocketAmmo"
 Weapon.AmmoGive 12
 Weapon.AmmoUse 1
 Weapon.SlotNumber 5
  States
  {
  Ready:
    MISG A 1 A_WeaponReady
    Loop
  Deselect:
    MISG A 1 A_Lower
    Loop
  Select:
    MISG A 1 A_Raise
    Loop
  Fire:
    MISG C 25 A_FireMissile
    MISG B 6
    Goto Ready
  Spawn:
    LAUN ABC 5
    Loop
  }
}

ACTOR Snapsplosion replaces Rocket 127
{
  Radius 2
  Height 8
  Speed 100
  Damage 20
  Projectile
  SeeSound "weapons/rocklf"
  DeathSound "weapons/rocklx"
  Obituary "$OB_MPROCKET" // "%o rode %k's rocket."
  States
  {
  Spawn:
    MISL ABC 5
    Loop
  Death:
    MISL B 8 Bright A_Explode
    MISL C 6 Bright
    MISL D 4 Bright
    Stop
  }
}

 

Edited by Szuran
Found the solution.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...