This syntax image_speed doesn't work on my animation

sniper4627

Member
My GameMaker Studio version is 1.4.1757

The problem is my character continues to animate or walk. I use the syntax image_speed = .2;
But the character still walking or animate


You may watch the video I made, so you can see what I'm talking about
Please tell me if I did something wrong and what is it?
:)

I beg for help.

The link of video
↓ ↓



Take a look

This is in Step Event

//MOVE UP

if (keyboard_check(vk_up))
{

phy_position_y -=5;
sprite_index = spr_husky_up;
image_speed = .2;
}
//MOVE LEFT
if (keyboard_check(vk_left))
{

phy_position_x -=5;
sprite_index = spr_husky_left;
image_speed = .2;
}
//MOVE DOWN
if (keyboard_check(vk_down))
{

phy_position_y +=5;
sprite_index = spr_husky_down;
image_speed = .2;
}
//MOVE RIGHT
if (keyboard_check(vk_right))
{

phy_position_x +=5;
sprite_index = spr_husky_right;
image_speed = .2;
}


In Create event


//Set fix rotation
phy_fixed_rotation = true ;
image_speed = 0;
 
A

Aura

Guest
A sprite would surely animate if image_speed is larger than 0, even if it is a small decimal value. If you set it to 0.2 and say, the room speed is 60, the image_index would increment every 60 x 0.2 = 12 steps.

In order to stop an animation from playing, set it to 0 when either the keys are released or no keys are being pressed.
 

sniper4627

Member
Just set image_speed = 0 BEFORE all the code in the step event. :)
Thank You very much sir, it works. But I do have another problem, I'm sorry Sir, I can't really manipulate the syntax. I manipulate the syntax, but it really doesn't work. I cannot do it without help.

The problem is this. I made a new character and its a Tank .
The movements are left key, right key and up key. Left and right key will change the angle of image left and right.
But the problem is I can't accelerate using Up key.



In event keyboard <left>
image_angle = image_angle +2;

In event keyboard <right>
image_angle = image_angle -2;

In event keyboard <up>
motion_add(image_angle,0.2);
if(speed > 5) speed = 5;

In event Step
speed = max (speed - 0.01, 0);

Video
↓ ↓

As you can see in the video, it only rotates the image or object. It doesn't move forward or accelerate.
Please tell me what's wrong please. I beg for help.
 
Top