if the player walks for more than 2 seconds then he will start running?

0 favourites
  • 3 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • How do I check the times that have passed since player did something?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could always have an instance variable tick up. It would look like an instance variable called "timeSpentWalking" or something, and if the player is currently walking, then add 1 to that instance variable. This will add to the timeSpentWalking variable every tick. If the player is not currently walking (or running I guess), then reset the variable back to 0. Then you can compare the variable to some constant. In your example, if the character is walking for 2 seconds, then you just have to compare to 2 seconds worth of ticks (60ticks/second --> 120 ticks for 2 seconds). It might look like:

    If character Platform Is Moving, then Add 1 to timeSpentWalking

    If character X Platform Is Moving, then set timeSpentWalking to 0

    If character.timeSpentWalking = 120, then [whatever you want running to look like, including a different animation, or a Platform max speed increase, or new moves available, etc.]

    You might instead bind the first and second Ifs to whatever button you're using to walk/run, like:

    If Keyboard Is pressing Right, then Add 1 to timeSpentWalking

    If Keyboard X Is pressing Right, then set timeSpentWalking to 0

    Play with something like that to get a better result, like also adding not pressing left e.g. Hope that helps!

  • Or use Timer behavior.

    Player is NOT moving
     .. Player Set Max Speed to 100 
     .. Player Start "run" timer for 2 seconds
    
    Player On "run" Timer 
     .. Player Set Max speed to 200
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)