• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM How to make an alarm that starts & loops in the step event ?

T

TankRockett

Guest
I'm making an enemy object where the enemy will go on a specific path to patrol.Then he will stop at a certain point to look around for the player.

I planned to make him change his sprite direction every 2 seconds(Enemies vision's for another day)but i seems to stuck here.I want the alarm to start as soon as he stops in the middle of the path,but i don't know how to activate the alarm in the step event.

Any ideas ?
 

TheouAegis

Member
Set an alarm when you start the path. When the alarm triggers, set a different alarm and set path_speed to 0. While the other alarm is counting down, have the enemy look around. When the alarm finishes counting down, set the first alarm again.

Code:
alarm[0] = path_length(path_index)/2;
Code:
path_speed = 0;
alarm[1] = room_speed * 2;
Code:
alarm[0] = path_length(path_index)/2;
path_speed = walkspeed;
 
Top