W
Wild_West
Guest
I hadn't noticed i had this problem until messing about with level design, but I have these 2 standard enemies that chase after the player, and I only ever did it for a sideways check, since that's all I needed.
But I tried putting my player underneath a platform with the chasing enemies on top and stood directly over the player. They only chase when the player's x is greater than or less than their own x value, and animate and change their x scale when doing so of course, but when they aren't chasing I want them to not animate or move at all.
Problem is this doesn't happen, the enemies stay stationary like hey should but they keep flipping their x scale back and forth like their trying to wait for the next direction to move in even though the player is standing still.
I've tried using this to keep their image still but it doesn't work so I think I'm still misunderstanding how 2 object's x and y values are calculated in relation to each other?
if(x < player_parent_object.x)
{
if(place_free(x + 50, y) )
hspeed = 7;
image_speed = 0.2;
image_xscale = 1;
}
if(x > player_parent_object.x)
{
if(place_free(x - 50, y) )
hspeed = -7;
image_speed = 0.2;
image_xscale = -1;
}
if(x == player_parent_object.x)
{
hspeed = 0;
image_speed = 0;
}
But I tried putting my player underneath a platform with the chasing enemies on top and stood directly over the player. They only chase when the player's x is greater than or less than their own x value, and animate and change their x scale when doing so of course, but when they aren't chasing I want them to not animate or move at all.
Problem is this doesn't happen, the enemies stay stationary like hey should but they keep flipping their x scale back and forth like their trying to wait for the next direction to move in even though the player is standing still.
I've tried using this to keep their image still but it doesn't work so I think I'm still misunderstanding how 2 object's x and y values are calculated in relation to each other?
if(x < player_parent_object.x)
{
if(place_free(x + 50, y) )
hspeed = 7;
image_speed = 0.2;
image_xscale = 1;
}
if(x > player_parent_object.x)
{
if(place_free(x - 50, y) )
hspeed = -7;
image_speed = 0.2;
image_xscale = -1;
}
if(x == player_parent_object.x)
{
hspeed = 0;
image_speed = 0;
}