Processing – Small Game

This lesson we upped our game a bit and we decided to make a small interactive game with a score board!

There were so many things we had to fix and think of to make a game that works and loops without stopping for whatever reason. It will be a game of a moving sphere that you need to line up with a space on the bottom part of the screen and press ”space” to make it fall down. if the ball falls in the space then you get 10 points if you touch the bottom space that is blocked out you miss and you will lose 5 points! Easy as that.

We started by indicating where our sphere will start, which way it will go and where to start again when it resets. Also we thought of the speed of the ball, how it will interact with the space button and when it has to fall. Lastly we had to make the score board on how you will get points or lose them. All those were placed in the program with floats.

After that we chose the size of our window and made 3 different groups for each thing that we will have and placed them under ”void draw();”

First things first we started with an IF statement with how fast the ball will go and how fast the ball will drop.

After that we indicated where the goals space will be at the bottom of our small game and how to count the score when you put it in the goal or when you miss it. Also we placed a print to say if we got a goal with how many points and if we got a miss with how many points we lost.

After that come the shapes of the sphere and the gap on the bottom and of course the colors and background of it all. So we placed all of those in a draw everything section of ”void draw”

Last thing and most important is to make the ball drop when we hit space, so we added the ”void keyPressed” command to put it all together! Here is the video of how to make this small game, the code and how it works! Enjoy!

 

Leave a comment