-
Notifications
You must be signed in to change notification settings - Fork 5
Reaction Game
In this lesson, we will create a simple reaction time game using a canvas, an image sprite, a timer, and a little bit of math. We will pick a random location within the canvas for the image sprite to be placed at, and the user will have to press the image sprite as fast as they can after it appears. Then, we will display the user's time.
First, we set the AlignHorizontal property of the screen to be 'Center' so that everything will be centered (this step is optional). Next, we insert a label, followed by a button and another label. The topmost label will be used to tell the user how to play the game (something along the lines of "press the image as fast as you can after it pops up"). The button in between the 2 labels is the start button, which will eventually add time to the timer and spawn the image sprite in a random location within the canvas. The bottom label is used to display the time it took the user to press the image after it appeared.