1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    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,142
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice