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

How to make the last sprite of gun firing animation remain until you stop firing?

Question

I have a 4-frame gun animation.

 

Frame 1 - gun ready

Frame 2 and 3 - when you press 'fire' these get the gun into firing position

Frame 4 - the gun is in position and I want it to remain there until you stop firing

 

I cannot make the animation not loop back to frame 2.


This is the code I'm working with. I know I mixed BFG with plasma, but that works fine. Help, please.

 

Quote

Fire:
    PLSG B 3 A_BFGSound
    PLSG C 3 A_FireBFG
    PLSG D 20 A_ReFire
    Goto Ready

 

 

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

You have to use the state label, not the state itself. Labels are things like Fire, Hold, Spawn, etc. So you need a state label called Hold that then loops the frames you want, then repeat A_ReFire in it.

 

Fire:
    PLSG B 3 A_BFGSound
    PLSG C 3 A_FireBFG
    PLSG D 20 A_ReFire("Hold")
    Goto Ready

Hold:

    PLSG D 5 A_ReFire

    Goto Ready

 

Something like that.

Share this post


Link to post
  • 1

nevander posted an infinite loop. Never, ever jump to a given state from the same state, actions are executed immediately and so it starts doing nothing but running that loop until GZD determines something's wrong and closes the application. Do something like this instead:

 

Hold:
    PLSG D 1
    PLSG D 0 A_Refire
    Goto Ready

Share this post


Link to post
  • 0

I don't get this wiki entry. What is the state I should enter?

 

PLSG D 5 A_ReFire [(str PLSG D)]

PLSG D 5 A_ReFire [(str "PLSG D")]

PLSG D 5 A_ReFire [(str "fire")]

 

They don't work. What should I enter there?

Share this post


Link to post
  • 0

Thanks, that's something that could've been explained better in the wiki, but... Hmm, using this Hold label causes some error that closes the app.

Share this post


Link to post
  • 0

Thanks for explaining. This still didn't work as it held the frame but didn't cause the projectile to appear, so I added

 

Hold:
    PLSG D 1
    PLSG D 6 A_FireBFG
    PLSG D 1 A_Refire

 

And now it works perfectly!

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
×