Fangames > Programming Questions
Can I make a sprite pause?
(1/1)
PlasmaKaboom:
Is it possible to make a sprite freeze in place in the middle of it's animation?
PiranhaTooth:
The way in which to do this is to set the image_speed variable to equal 0. This means it's going to cycle through 0 images every frame/step. If you wanted to do this in the middle of an animation, say at a specific frame of the animation, for example frame 14, you'd do something like
--- Code: ---if(image_index = 14)
{
image_speed = 0;
}
--- End code ---
For an example like this, every time the sprite finds itself on the 14th image of it's animation, it will stop cycling through the images of the animation, because the speed of which it cycles though the animation is set to 0. You could implement a Boolean (true/false) variable in the creation code called imageFreeze or something, and have it so that has to be set to true as well as the image_index being 14. This way while you don't want it to freeze (in this case having imageFreeze being false), it's still able to cycle through its animation normally.
Navigation
[0] Message Index
Go to full version