16
Programming Questions / Re: Can I make a sprite pause?
« on: April 22, 2017, 12:44:39 AM »
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
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.
Code: [Select]
if(image_index = 14)
{
image_speed = 0;
}
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.