ForumsProgramming ForumLooking for Reaction Time tutorial

5 5011
PHLHimself
offline
PHLHimself
300 posts
King

Hiya Everybody, Trying to learn some game design etc as a free time hobby and I wanna try my hand at making a small reaction time/quick draw game by leveling up and each level having a shorter reaction time.

For example, like Kupo's game here:
https://armorgames.com/play/2899/brawl-royale

Or these games:
http://www.bullettimereaction.com/
https://www.youtube.com/watch?v=3BeYJQrtT04

So basically it needs a timer, but when it goes over that timer it's game over (getting shorter with each good run)
Not some prompt that appears on a timer starts and stops to show you the time of your reaction (like this: https://codepen.io/cliff538/pen/Eslxr)

Tyring to search for it on google, but I don't have any succes.
I just stumble upon other quick draw games or apps or something not game related.

I have most of the adobe programs to draw (that's not a problem) but I'm looking for a coding tutorial for this. I can code in flash and html/css so either one of those languages would be great. Anyways thanks for the help.

  • 5 Replies
Miraidematro
offline
Miraidematro
738 posts
Blacksmith

Hey!

Since you can write multiple languages, I'm going to give you some pseudocode. It's not that hard of a problem, so I know you'll get the idea.

- We know the 'timer' and 'level number' share a negative correlation
- If 'input' while the timer is still active, the player advances
- If the timer runs out before 'input', the player loses

You can make the negative correlation as complicated as you want.
Something simple could be:
Timer = 100 - 5*levelNumber;

When the level starts you just keep deducting from the timer value.
Timer -= 1;

During the level you keep checking for the aforementioned conditions.

if(Timer <= 0){
    playerLoses();
}else if(input){
    goToNextLevel();
}
PHLHimself
offline
PHLHimself
300 posts
King

A reminder that I only used coding for making sites, not gaming, just decided to have a go with that in my spare time

Thanks for the input, as for the timer, I want it to appear randomly.
So for example, the two characters wait, then "go" appears with a sound and then the timer starts counting for the enemy. So basically I need two timers?

A random generated timer to for an insivisble countdown. Let's say it's always longer than a second but never longer than 5 seconds.
TimerCountdown= Math.random()*5;

And a timer for the time you need to react, which is the thing you suggested
So when the first var expired this next one starts
TimerEnemy= 100 - 5*levelNumber;

Correct? Anyways thanks for the help so far

PHLHimself
offline
PHLHimself
300 posts
King

I found this tutorial though however.
https://www.youtube.com/watch?v=pzr1f85xeMc

I guess it's a bit the same where I'm going at? Just without the random letters generated to press, since I just want the spacebar to be pressed.

Miraidematro
offline
Miraidematro
738 posts
Blacksmith

@PHLHimself Yes that's correct, you would need two timers
Good luck on the project!

PHLHimself
offline
PHLHimself
300 posts
King

Thanks, I hope I'll find my way, but I guess it will be a lot of trial and error

Showing 1-5 of 5