How to track event "not moving" ?

Discussion in 'Programming' started by Antera, May 14, 2019.

Tags:
  1. Antera

    Antera Member

    Joined:
    May 14, 2019
    Posts:
    27
    Hello,

    I just finished the tutorial DND arena shooter, Game Creator Studio 2 is wonderful and I already forgot all other game creators !

    I'd like to track when the player is not moving
    I set up var moving = 0 on create event
    And var moving = 1 when key down left/right/up/down

    What is the event to track to set back moving to 0 when player is not moving ?

    Many thanks for your help
     

    Attached Files:

  2. Antera

    Antera Member

    Joined:
    May 14, 2019
    Posts:
    27
    Update : I succeeded with an alarm, yeah !

    Solution : when move (keydown), set alarm to 30 for example
    Then event alarm your action, set cooldown alarm
     
  3. BattleRifle BR55

    BattleRifle BR55 Member

    Joined:
    Jun 24, 2016
    Posts:
    947
    You don't necessarily need an alarm, you could just track the differences between x and y with xprevious and yprevious. If both sets match, the player isn't moving. By paying attention to coding and event order, you could also set moving to 0 before they key checks, which would set it to 1, and then use the variable afterwards for whatever its purpose is.
     
    Antera likes 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