i prefer a gml code, but i can drag and drop too.
Problem with enemy sprites
Started by Hubster, Jun 12 2012 12:58 PM
3 replies to this topic
#1
Posted 12 June 2012 - 12:58 PM
I don't know how can i do that an enemy go in a path, and at the ssme time, it change its sprite to enemy_right, enemy_left....
i prefer a gml code, but i can drag and drop too.
i prefer a gml code, but i can drag and drop too.
#2
Posted 12 June 2012 - 01:29 PM
Do you want it so that the enemy only can face 0, 90, 180 and 270 degrees?? or do you want him to face in the exact direction as he is going?? I guess the first(considering to your post), and in that case i guess:I don't know how can i do that an enemy go in a path, and at the ssme time, it change its sprite to enemy_right, enemy_left....
i prefer a gml code, but i can drag and drop too.
if direction < 45 && direction > 315
{
sprite_index = enemy_right; // Facing right
}
if direction < 315 && direction > 225
{
sprite_index = enemy_down; // Facing down
}
if direction < 225 && direction > 135
{
sprite_index = enemy_left; // Facing left
}
if direction < 135 && direction > 45
{
sprite_index = enemy_up; // Facing up
}
EDIT: sorry, forgot that you wanted different sprites, but i fixed it now and i think it should work
Edited by mrokke96, 12 June 2012 - 01:32 PM.
#3
Posted 12 June 2012 - 01:29 PM
Maybe something like this
EDIT:
Or, if you want it to rotate smoothly:
if x-xprevious > 0 {
sprite_index = spr_leftImage;
}
if x-xprevious < 0 {
sprite_index = spr_rightImage;
}
EDIT:
Or, if you want it to rotate smoothly:
draw_sprite_ext(spr_rightImage,-1,x,y,1,1,direction,c_white,1)
Edited by M.D.Simmo, 12 June 2012 - 01:33 PM.
#4
Posted 12 June 2012 - 01:36 PM
thanks, now i can finish my game!!!!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











