GML Enemy AI - UP AND DOWN

S

shoyguer

Guest
Hello, for hours I'm trying to programming the AI of the enemies of my game but I have a throuble....
I just want to do the ghosts (enemies) fly up and after some seconds fly down, and do an infinite loop.
Here's my code:


Create:

ydirection = 1;
yspeed = 0.35;

loop = 0;


--------------------------


Step:

if (loop <= 10) {
alarm[1] = 120;
loop = loop + 1;
}

y = y + (yspeed * ydirection);

---------------------

Alarm[1]:

ydirection = ydirection * -1;

---------------------------------------------------


Thank you all !!!!
 
S

shoyguer

Guest
Top