In this assignment, you’ll create a simple “pod-racing” game with Processing. This game is single-player, so you only need to worry about “controlling” one entity on the screen. When you start up the game initially, there will be a single pod-racer on on the left of the screen. Below is a screen capture of the game being played. The screen-capture includes one instance of “losing”, then restarting the game, and then winning.
The game should work as follows:
You are allowed to take creative liberty with colors and designs.
The only code you are allowed to put into draw()
are if-statements and calls to functions that you have written.
You may not draw any shapes, respond to mouse clicks, etc. within draw()
.
Instead, put your code into at least three separate, well-named functions.
As with the last assignment, this one might seem rather complex. If you break the problem down into smaller “chunks” it becomes much more manageable to tackle. I recommend you use the following strategy to complete:
First, just get the background color and simple pod-racer (for now, just a rectangle) drawing on the screen. Make sure that the rectangle moves up/down with the ‘w’ and ‘s’ keys. For example:
At this stage, you should also make sure that the pod-racer cannot go out-of-bounds of the canvas.
Next, add in some obstacles. For now, do not worry about detecting that the pod-racer has hit an obstacle. Just get them displaying on the screen, and moving across. Remember, you need at least 5 obstacles. In the example, 12 are shown, but you don’t need that same amount.
Next, get the winning logic to work. Remember: A player wins once they have passed all of the obstacles on the track. When this happens, You should display a “win” message, and allow the user to replay with the ‘r’ button. Remember: don’t worry about handling the “losing” yet.
Now, let’s handle “losing”. This is probably the most tricky part of this assignment. Visit This link for a nice description of how to check if two rectangles overlap. When one of the obstacles overlaps with the player, the “lost” message should be displayed, and the user can optionally restart. Next, we need to replace the rectangle with an actual pod-racer. You may get as “fancy” with this as you like, but the racer should use at least three shapes and two lines, like pictured below
Next, we need to replace the rectangle with an actual pod-racer. You may get as “fancy” with this as you like, but the racer should use at least three shapes and two lines, like pictured below. The pod-racer should fit within the same size as your original rectangle, so that the collision logic still works properly.
All of your programming should be well-formatted and easy for the graders to read and comprehend. You should follow the style guidelines that we have discussed in class. Each program file should have a header comment at the top that has roughly the following format:
//
// Author: Student Name
// Description:
// A short description of what this program does!
//
If any part of your scripts are particularly complex, you should put documentation comments above those lines of code.
Name your program netid_pod_racing.pde
(where netid
is your UA username).
This was assigned on 10/27/2017. It is due on 11/3/2017 at 5:00pm.
Turn in each of the files described in the spec (just 1) the assignment drop-box in D2L before the due date. Make sure to name the files exactly as this document specifies. In general, make sure to follow these instructions precisely. If you don’t, we will deduct points!!!