# How do I Do Something If WASD is held down for some time?

Get help using Construct 2

### » Sat Mar 26, 2016 9:24 pm

I always ask an excessive amount of questions and I'm sorry for that, I've been on here a lot lately.
I'm making a retro game. I'm making it so if the player hold down W, A, S, or D down for a randomized amount of seconds (say like from 15-30), they have to battle a new enemy that comes up to you. How would I make it so that they do this? I'm still trying to figure it out... help . Thanks
Alright, I've been thinking. When life gives you lemons, don't make lemonade! Take the lemons back! GET MAD! I DON'T WANT YOUR DANG LEMONS WHAT AM I SUPPOSED TO DO WITH THESE?! Demand to see life's manager!! Do you know who I am!?!?! I'M THE MAN WHOS GONNA BURN YOUR HOUSE DOWN... WITH THE LEMONS
B
17
S
9
Posts: 157
Reputation: 2,150

### » Sat Mar 26, 2016 10:17 pm

You can use a counter variable. This can let you keep track of how long your key has been down for.

Then use that counter as a condition for an event.

This is the quick way, but the problem is the random(15,30) will give you a new random number every tick, so basically you will never get to 30. If you want, you can use another variable to store the target time once, and have the condition compare the two variables to run your spawn action instead.
B
60
S
30
G
131
Posts: 1,930
Reputation: 73,837

### » Sun Mar 27, 2016 3:06 am

Alright, I've been thinking. When life gives you lemons, don't make lemonade! Take the lemons back! GET MAD! I DON'T WANT YOUR DANG LEMONS WHAT AM I SUPPOSED TO DO WITH THESE?! Demand to see life's manager!! Do you know who I am!?!?! I'M THE MAN WHOS GONNA BURN YOUR HOUSE DOWN... WITH THE LEMONS
B
17
S
9
Posts: 157
Reputation: 2,150