Condition trigger time

Get help using Construct 2

Post » Tue Jun 27, 2017 3:00 pm

I want to add a feature to my game where you have to hold the escape button for a while to exit the game. Kind of just like in Undertale. But i don't know how to make the action (close the game) only happen when i pressed the button for a certain time.
Can i get some help on this?
B
3
Posts: 2
Reputation: 179

Post » Tue Jun 27, 2017 3:16 pm

You can increment a variable every 0.2 sec by 1, and lets say when it gets to 10 close the game.
You will need 2 events

on key being held down esc,every 0.2 sec, add 1 to timer
timer == 10 -> close game or what you plan to do

This will exit the game after 2 sec holding the button, also if lets say player stops holding the button before it gets to 10 you have to reset it to 0, you can do this by inverting the event and changing the action to set timer 0.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Tue Jun 27, 2017 3:46 pm

Thx it worked!!!
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: JackTYGA and 22 guests