Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Szuran

How to make an animated weapon pickup?

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?

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 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.

Share this post


Link to post
  • 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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×