I have been working on a flying enemy that swerves back and forth and often times changes its elevation I have to code it the best of my abilities but the sprites themselves just vanish into thin air. It is hard to put it into words so I have a video to give general idea i am trying to aim for.
here is the code I used to attempt this:
Create Event:
Alarm 1:
Alarm 2:
Step Event:
Draw Event:
here is the code I used to attempt this:
Create Event:
Code:
//alarm to change the X axis
alarm[1] = choose (100,150);
//Alarm to change the Y axis
alarm[2] = choose (100,150);
Code:
//Change the X axis
if (facing == 1)
{
x *= -1;
}
if (facing == -1)
{
x *= -1;
}
//Reset Alarm
alarm[1] = choose (100,150);
Code:
//Change Y axis
if (facing == 1)
{
y *= -1;
}
if (facing == -1)
{
y *= -1;
}
//Reset Alarm
alarm[2] = choose (100,150);
Code:
if (facing == 1)
{
x += 1;
}
if (facing == -1)
{
x -= 1;
}
image_xscale = sign(x);
Code:
draw_sprite_ext(spr_Enemy,sprite_index,x,y,facing,1,0,c_white,1);