K
kafka84
Guest
Hi,
I'm trying to change my enemy sprite to the direction it is moving
The code I'm trying to use is
Step)
switch (direction div 90)
{
case 0: sprite_index = spr_guard_run_right ; break;
case 1: sprite_index = spr_guard_run_left ; break;
case 2: sprite_index = spr_guard_run_down ; break;
case 3: sprite_index = spr_guard_run_up ; break;
}
Draw)
if xprevious = x && yprevious = y
draw_sprite (spr_sguard_d1, -1,x,y)
else
draw_sprite (sprite_index,-1,x,y)
The idle sprite does work when it is still but whenever the enemy object moves it only uses the run right sprite
Any idea where I'm going wrong?
Thanks
I'm trying to change my enemy sprite to the direction it is moving
The code I'm trying to use is
Step)
switch (direction div 90)
{
case 0: sprite_index = spr_guard_run_right ; break;
case 1: sprite_index = spr_guard_run_left ; break;
case 2: sprite_index = spr_guard_run_down ; break;
case 3: sprite_index = spr_guard_run_up ; break;
}
Draw)
if xprevious = x && yprevious = y
draw_sprite (spr_sguard_d1, -1,x,y)
else
draw_sprite (sprite_index,-1,x,y)
The idle sprite does work when it is still but whenever the enemy object moves it only uses the run right sprite
Any idea where I'm going wrong?
Thanks