How do I do a 'if true for x seconds' thing?

0 favourites
  • 3 posts
From the Asset Store
Like tourists, Travel around the world as fast as you can!
  • I have this game im making where you have to break tiles to unblock your way to the exit of each level, and I want to make it so you have to click each tile for 1 second before it breaks. I don't know how to do this though. Hoping for a simple block or plugin.

    Tagged:

  • Use a timer behavior on your sprite. When you click it, start the timer. When the timer completes, destroy the object. If you let go of the mouse button or move off the object, stop the timer so it never completes.

    + Mouse: On Left button Clicked on Sprite
    -> Sprite: Start Timer "countdown" for 1.0 (Once)
    
    + Mouse: On Left button released
    + Sprite: Is Timer "countdown" running
    -> Sprite: Stop Timer "countdown"
    
    + Sprite: Is Timer "countdown" running
    + Mouse: [X] Cursor is over Sprite
    -> Sprite: Stop Timer "countdown"
    
    + Sprite: On Timer "countdown"
    -> Sprite: Destroy
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another option is to do this with a couple of variables.

    Mouse On sprite clicked
    ....Set variable lastClick to time
    ....Set variable clickedUID to Sprite.UID
    
    Mouse On left button released
    Mouse Cursor is over Sprite
    Sprite pick by unique ID = clickedUID
    Compare variable lastClick<(time-1)
    ....Sprite destroy
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)