The Game Demo

The Game Goal

If you'd like to see what the final game will look like, here's the playable link: https://editor.p5js.org/empressdragonlady/full/cvGM_OlLt

The object of the game is to touch the treasure chest as many times as you can before the timer runs out. You will notice that when we run the game, we have a player character that we can move, and if we touch the treasure chest, we increase our score by 1 point. The treasure chest moves to a new position on the screen when we touch it.

There is a timer at the top of the screen, as well as the score indicator.

After the timer runs out, we get a "Game Over" screen that tells us the high score. The game over message also tells us what the high score was. The player can restart the game to try and get a better high score.

Controls

We use the arrow keys on the keyboard (up, down, left, and right) to move in all four directions.

To restart the game, press the Enter key when the "Game Over" screen is displayed.

Course Breakdown

We're going to break it into 5 steps, and I suggest that you take a short pause after each step and make sure you understand part of the code.

I've made the code available for each step, so you can take closer look at it and compare your code with what I've written if you have any mistakes in your work.

You can find the code for each step here: https://editor.p5js.org/empressdragonlady/collections/hQ1izMb5c

As I'm typing, try to make sure you type exactly what I type as much as possible, to prevent errors. Coding is very exact, and even small changes can make a big difference. If you decide to continue on to learn programming, you'll eventually understand why I'm advising this, and then you won't have to follow me exactly, but to begin with, let's try to be very exact. This includes things like:

  • Capitalization
  • Spelling
  • Word choice
  • Spacing


Complete and Continue