1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 How to make an alarm that starts & loops in the step event ?

Discussion in 'Programming' started by TankRockett, Sep 6, 2019.

  1. TankRockett

    TankRockett Member

    Joined:
    Aug 28, 2019
    Posts:
    4
    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 ?
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,447
    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;
    
     

Share This Page