Jump to content
  • 0

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


Szuran

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

What you need is a state label inside A_ReFire. It can be used to send the weapon to another state if the trigger is still being held, in your case a state where the last frame is looped.

 

https://zdoom.org/wiki/A_ReFire

Edited by Nevander

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

Edited by SaladBadger

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

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