If In Touch for More Then 2 Seconds?

0 favourites
  • 5 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Hey folks, trying to grasp the idea on how to find out to do the following:

    +If player touches and holds screen(in touch) for more then 2 second...

    Does construct allow in touch to be calculated by how long the player holds down on the screen.

    I am trying to do the following:

    + If player or holds down screen for more then 2 seconds, then gets a burst of speed to that position.

    Or... the other way..

    + If player taps on screen 2x (quickly.. like double tap). then the player gets boost.

    Any ideas on how to do either of these.

    Thanks

  • Use the system expression 'time' for both.

    + Player touches -> Set global 'timestamp' to time
    + Is in touch
      + time - timestamp >= 2
        trigger once             -> give burst
    
    + Player touches
      + global 'doubletap' = 0 -> Set global 'timestamp' to time
                                  Set global 'doubletap' to 1
      + else
        + time - 'timestamp' < 0.3 (or however fast you like) -> give boost
    

    Just make sure you reset the globals correctly and at the right times.

  • Thank you SOOOO Much!

    This worked perfectly.

    I am still amazed how you came up with this in your head.

    However you did it, i am very grateful for the help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am still amazed how you came up with this in your head.Most of the time I wonder myself <img src="smileys/smiley36.gif" border="0" align="middle" /> I'm glad I could be of help.

  • Knowing the system expressions can really help out a lot when learning a new programming language.

    https://www.scirra.com/manual/126/system-expressions

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)