Repeat an action by a set of time (drag'n drop)

Discussion in 'Programming' started by Mauricio Antunes, Oct 8, 2016.

  1. Mauricio Antunes

    Mauricio Antunes Member

    Joined:
    Oct 8, 2016
    Posts:
    34
    Hi nice to meet you all.
    I just purchased this software and i really suck at programming so i'm using more drag and drop functions to create my first game, but i have a question and i hope you guys can help me.
    I need to create an event that spawn a certain object at every 2 seconds and i'm failing hard to do it.
    How could i do it using the drag and drop menu of game maker?
     
  2. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    930
    You can use alarms. In the create event, set an alarm 0 to 60 (which should be your room speed multiplied by 2 (because you need 2 seconds). I said 60 because the default room speed is 30). Now, create an alarm event. There put your instance create action, and then there too put an alarm action setting alarm 0 to 60. Hope this helps :)

    EDIT: Like this:



    [​IMG]
    [​IMG]
     
    Mauricio Antunes likes this.
  3. Gaspode

    Gaspode Guest

    Use an alarm, set to repeat every 2 seconds.
     
    Mauricio Antunes likes this.
  4. Mauricio Antunes

    Mauricio Antunes Member

    Joined:
    Oct 8, 2016
    Posts:
    34
    THANK YOU SO MUCH =D
     
  5. FlatulenzaFiamm

    FlatulenzaFiamm Member

    Joined:
    Jul 11, 2018
    Posts:
    115
    I don't get it. Also, I can't see the images you posted.
     
  6. Carl Nylander

    Carl Nylander Member

    Joined:
    Jul 21, 2016
    Posts:
    212
    1) Add a Create event in your object.
    2) Add a Alarm action in your Create event and set it to 60.
    3) Add a Alarm event in the same object.
    4) Add a Instance create action in your alarm event and select the instance you like to spawn.
    5) Add a Alarm action in your Alarm event and set it to 60 so that the alarm will repeat itself.

    Let me know if there is anything that's unclear about this
     

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