How can I reset a sprite's animation? (DnD)

B

bebesnuggles

Guest
I need to reset a timer bar from going all the way down so it doesn't dock the player points if they hit a target. Been looking through all the DnD code and syntax but can't find anything that would help me. Good thing yall are much smarter than me!
Thanks
Ya Boi
 
I think we'll need an example of the code to fully understand what it is that's going on.

Based off my own foolish assumptions, I am guessing you require some sort of reset code since the timer bar may be going into the negative range. Simply put, all you'll need to do is set an event that resets the timer when the player hits the target. And the timer itself should never reach below 0.


GML:
//Basic Example

//Create Event
timer = room_speed * 3;

//Step Event
if (timer > 0){timer -= 1;}
if (timer <= 0){timer = 0;}

//Collision Event
timer = room_speed * 3;
 
B

bebesnuggles

Guest
I figured it out, if I just destroy and then re-create it, it does what I want. Thanks anyway bro!
 
Top