In this assignment, you’ll be writing the same tag program that you wrote in the last assignment. The features and functionality will be exactly the same. In fact, you are allowed to re-use your code! However, you need to re-structure your code to use functions.
Your new program should have at least the following functions:
drawGridLines
which draws the grid across the canvas.
This function does not need any parameters.drawCharacterA
to draw the character that starts in the top-left.
This function should have two parameters: The X and Y value of character A.drawCharacterB
to draw the character that starts in the bottom-right.
This function should have two parameters: The X and Y value of character B.isTagged
that will check if the two players are currently on-top of each-other.
This function should take 4 parameters: The X and Y coordinates of each player.drawScoreBar
that will handle drawing/updating the score-bar at the bottom of the canvas.
This function does not need to take any parameters.You may add more functions as well.
The only code that you are allowed to have in draw()
are calls to the functions that you write.
You are not allowed to use if-statements, for-loops, or draw any shapes directly inside of draw()
.
The idea here is that you can take the code you submitted for the last assignment, and “re-factor” it to use functions.
The final behavior of the game should be the same as the last assignment, like so:
As usual, if you cannot implement all of the features, you should still submit your code!
You will get credit for each working feature.
Name your program netid_tag_wf.pde
(where netid
is your actual UA netid).
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. Every function that you write should have a block-comment above it.
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!!!