Game Development Reference
In-Depth Information
Setting the animation speed of a sprite
The
image_speed
variable allows users to set the animation speed of a sprite. By de-
fault, this animation speed is set to
1
. The animation speed of a sprite is based off the room
speed. If the image speed is set to
1
and the room speed is set to
30
, the animation will run
through 30 frames every second.
The
image_speed
value is a multiplier, so to halve the animation speed, we will set it to
0.5
. This will mean, with a room speed of
30
, the animation will run through 15 frames
per second as it takes two steps to run one frame.
The following is the example code:
image_speed=0.5; //half speed