T
Tanner021
Guest
Hey all,
So, I am stuck in a situation where my main character is supposed to be stunned after being hit while also performing an animation and being moved slightly (automatically). The problem I am coming accross is that when he reaches the end of his animation (he is supposed to switch back to normal) he gets looped back into the same animation over and over again until he gets knocked off the stage. After digging I found out that the most likely problem is the image_speed in the reaction = 0 events.... When I remove it my player stops his movement and stops his animation so that he is back in his standing position. I would really like to have control over the speed of the animation, without it I have a player that moves as fast as flash.
movement = moveright + moveleft;
move = movement * movespeed;
if (place_meeting(x, y, o_enemyswinghitbox))
{
if place_meeting(x, y+1, o_walls)
{
reaction = 1;
}
else
{
reaction = 0;
}
}
if reaction = 1
{
move = 0;
x += sign(x -o_enemy.x) * 1.2;
image_xscale = sign(o_enemy.x - x);
sprite_index = s_maingettinghit;
image_speed = .2;
if image_index = 5
{
reaction = 0
}
}
if reaction = 0
{
if move = 0
{
sprite_index = s_mainstanding;
}
if move != 0
{
image_xscale = sign(move);
image_speed = move/35;
sprite_index = s_mainrunning;
}
}
x += move;
So, I am stuck in a situation where my main character is supposed to be stunned after being hit while also performing an animation and being moved slightly (automatically). The problem I am coming accross is that when he reaches the end of his animation (he is supposed to switch back to normal) he gets looped back into the same animation over and over again until he gets knocked off the stage. After digging I found out that the most likely problem is the image_speed in the reaction = 0 events.... When I remove it my player stops his movement and stops his animation so that he is back in his standing position. I would really like to have control over the speed of the animation, without it I have a player that moves as fast as flash.
movement = moveright + moveleft;
move = movement * movespeed;
if (place_meeting(x, y, o_enemyswinghitbox))
{
if place_meeting(x, y+1, o_walls)
{
reaction = 1;
}
else
{
reaction = 0;
}
}
if reaction = 1
{
move = 0;
x += sign(x -o_enemy.x) * 1.2;
image_xscale = sign(o_enemy.x - x);
sprite_index = s_maingettinghit;
image_speed = .2;
if image_index = 5
{
reaction = 0
}
}
if reaction = 0
{
if move = 0
{
sprite_index = s_mainstanding;
}
if move != 0
{
image_xscale = sign(move);
image_speed = move/35;
sprite_index = s_mainrunning;
}
}
x += move;