This site requires JavaScript, please enable it in your browser!
Greenfoot back
mitch2209
mitch2209 wrote ...

2013/1/30

Help for school project

mitch2209 mitch2209

2013/1/30

#
Hey I`d like to create a little game as my school project. You shall hit the shown key as fast as possible, then the next key appears. You need to hit the keys as fast as you can before the time goes up. (example: http://www.onlytypinggames.com/games/typing-test/) But I need some help, would be nice if some one has some suggestions.
danpost danpost

2013/1/30

#
Things you will need: - the alphabet: public static final String ABCs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - a start time: private long startTime; (set when first keystroke is detected, otherwise equals zero) - a score: private int matches; (the number of correct keystrokes) - a counter: private int attempts; (the number of actual keystrokes -- right or wrong) Plus, you will need to keep track of the currently displayed letter: - the letter: private String letter = ""; Things you will need to do: - get a random letter - catch a keystroke - compare any keystrokes returned (if keystroke was returned and startTime is zero, set startTime to current time) - keep tabs on the timer (only if startTime is not zero)
You need to login to post a reply.