Final+Assignment

=Final Project: Om-Nom, the game!=

Introduction
Writing software in the real world is a much more difficult process than what we've done so far. Lots of people are involved!

//Lead Designer/Software Architect ($100,000+/year)// This person (or these people) are responsible for the overall design of the program. They'll explain how the pieces fit together and split the work up so that everyone will have a piece to work on. They are "vision" people.

//Software Engineer ($50,000-$100,000/year)// This person (or these people) are responsible for making the designer's vision a reality. They'll be responsible for just a few small pieces of the overall design.

//Quality Assurance / Software Tester ($60,000-$120,000/year)// The QA person (or people) are the ones who make sure the software does what the Software Engineers and Designers say that it should do. Their work will include testing pieces as small as individual functions, or as large as the end product!

//Tech Writer ($50,000-$75,000/year)// The Tech Writer will make sure that things are documented correctly. They'll fine tune comments, and make sure that the code is in good shape to be used again in the future. They may also be responsible for writing manuals and other documentation.

There are other rolls as well depending on the type of software. For example, games will have someone in charge of Art, Game Balancing and Play Testing. The point is, it takes a lot of people to write software!

Assignment
Your assignment is to play the rolls of Software Engineer and Software Tester (perhaps with a bit of Art, Game Balancing and Play Testing thrown in as well). As the Lead Designer, I've created the basic outline of a great game I call Om-Nom. The mechanics are simple:

//You are a hungry creature! Use the keyboard to move the creature towards the food.// //Touch the food to eat it.// //The bigger the food, the more points you get.// //You have a limited amount of time to eat all you can!//

The game is already designed and the main part already implemented for you. As Software Engineers and Testers you'll need to implement the functions that make the game work. You can see demonstration versions on X:\MSIT\demos\final\ There are two versions:
 * minimum version: no real customization. (you would earn 100% with this version)
 * fun version: better art, better story, better everything! (you would get extra credit with this version)

Requirements

 * Correctly implement all functions: 28 pts
 * Demonstrate, outside of the game, that each function works as specified: 28 pts (that is, 3 tests [and their expected results] per function)
 * Neat, orderly code with comments: 4pts


 * Total: 60 pts (divided between 3 members. Individual total will be out of 20)**

**Extra Credit**
There is definitely a chance for extra credit in this program!
 * drawBackground is more than just a solid color background: 2pts
 * drawGameEndScreen changes depending on the player's score: 2pts
 * drawTarget draws something different than just a simple rect or ellipse: 4pts
 * drawPlayer draws something other than a simple rect or ellipse: 4pts
 * Substantial effort is evident to make the game 'cool': 5pts
 * Total: 17pts Extra Credit Possible!**

Procedure
There are 3 jobs:
 * **Tester**: needs to meet with me on Monday to understand how I want code tested. Will be responsible for testing the functions.
 * **Programmer**: will be responsible for implementing the functions
 * **Documentation** **Writer**: will be responsible for understanding the functions and explaining the pieces that I ask about.

**Given**
There are a total of 14 functions your team must implement. Their headers are below. code format="java" int increaseScore(int s, int prev) int changeTargetSize(int min, int max) boolean touchedTarget(int pX, int pY, int plSize, int tX, int tY, int tarSize)

//drawing related functions void drawBackground(color bg) void drawGameEndScreen(int s) void drawTarget(color target, int x, int y, int size) void drawTime(color tC, float t) void drawScore(color sC, int s) void drawPlayer(color player, int x, int y, int playerSize)

//movement related functions int moveTarget(int size) int moveUp(int y, int speed) int moveDown(int y, int speed) int moveLeft(int x, int speed) int moveRight(int x, int speed) code

The game, with unimplemented functions is below: code format="java" /** /*** BEGIN GAME OPTIONS ***/ //set starting position of player int pPosX = 200; //that is, player position X int pPosY = 200; int pSize = 50; //set initial position and size of target int tPosX = (int)random(0,300); //that is, target position x int tPosY = (int)random(0,300); int tSize = (int)random(25,100); //set up game rules float time = 20; int score = 0; //keys we will use to control the game char upKey = 'w'; char leftKey = 'a'; char rightKey = 'd'; char downKey = 's'; //size of the board, change this and the board gets bigger. final int BOARDSIZE= 300; //how fast the player moves, higher numbers move the player faster final int SPEED = 4; //set up the minimum and maximum sizes for our targets final int MINTSIZE = 50; //hard mode is when the minimum target size is smaller than the player! final int MAXTSIZE = 100; //various colors for different game elements color pColor = color(255,255,255); color tColor = color(255,0,0); color statusColor = color(0,255,0); color backgroundColor = color(0,0,0); /*** END OPTIONS ***/ void setup{ smooth; noStroke; size(BOARDSIZE,BOARDSIZE); rectMode(CENTER); //only need if you're using rectangles, see me if you're using something else } void draw{ //make a beautiful background drawBackground(backgroundColor); //draw the target in its current location with its size drawTarget(tColor,tPosX,tPosY,tSize); //if we still have time, draw the player, time and score if(time > 0){ drawPlayer(pColor, pPosX, pPosY, pSize); drawTime(statusColor, time); drawScore(statusColor, score); } //if someone presses a key - see if they are trying to move if(keyPressed){ //update the player position based on their last location, and the game speed. if(key == upKey) pPosY = moveUp(pPosY, SPEED); if(key == downKey) pPosY = moveDown(pPosY, SPEED); if(key == leftKey) pPosX = moveLeft(pPosX, SPEED); if(key == rightKey) pPosX = moveRight(pPosX, SPEED); } //test to see if the player is touching the target if(touchedTarget(pPosX,pPosY,pSize,tPosX,tPosY,tSize)){ score = increaseScore(tSize,score); //the bigger the object, the more the points! tPosX = moveTarget(tSize); //get a new X location for the target tPosY = moveTarget(tSize); tSize = changeTargetSize(MINTSIZE,MAXTSIZE); //get a new target size } //if we're out of time, end the game! if(time<=0){ drawGameEndScreen(score); } //each time we check everything, decrease the time and start over at the top time -=.01; } //end void draw /*** BEGIN FUNCTIONS ***/ /** void drawBackground(color bg){ } /** void drawGameEndScreen(int s){ } /** int moveTarget(int size){ } /** int changeTargetSize(int min, int max){ } /** boolean touchedTarget(int pX, int pY, int plSize, int tX, int tY, int tarSize){ } /** void drawTarget(color target, int x, int y, int size){ } /** void drawTime(color tC, float t){ } /** void drawScore(color sC, int s){ } /** int increaseScore(int s, int prev){ } /** void drawPlayer(color player, int x, int y, int playerSize){ } /** int moveUp(int y, int speed){
 * Title: Om-Nom
 * Game Designer: Lyle Kozloff
 * Date: May 17, 2012
 * Description: In Om-Nom you control a creature who wants to eat things!
 * the bigger the thing it eats, the more points you get!
 * Guide the creature to the targets to eat them. Careful though, you have
 * a limited amount of time!
 * title: drawBackground
 * arguments: a background color
 * returns: void
 * description: sets the background color to the specified color
 * title: drawGameEndScreen
 * arguments: the score, s
 * returns: void
 * description: displays the game ending screen, including the score
 * title: moveTarget
 * arguments: size of the target
 * returns: a random int within the bounds of the screen (affected by how big the target is!)
 * description: generates a coordinate that will let the target be on screen for the current size
 * notes: the target should always appear fully on screen.
 * hint: you can use the variable BOARDSIZE to make sure your target isn't half on and half off the screen
 * title: changeTargetSize
 * arguments: minimum and maximum size of target
 * returns: a random int between the minimum and maximum size
 * description: generates the size of your target
 * title: touchedTarget
 * arguments: player location and size, target location and size
 * returns: true if the target is being touched by the player, false if not
 * description: see above
 * notes: you can assume that if the center of the player is inside the target, it is being touched.
 * hint: this is similar to what we did in PaintPots
 * title: drawTarget
 * arguments: a color, x position, y position and size of target
 * returns: void
 * description: sets the target color to the specified color, and it's position to x and y with size
 * title: drawTime
 * arguments: a color and the current time
 * returns: void
 * description: displays the time remaining on the screen
 * title: drawScore
 * arguments: a color and the current score
 * returns: void
 * description: displays the current score on the screen
 * title: increaseScore
 * arguments: the amount you want to increase the score by (s) and the previous score (prev)
 * returns: the new score
 * description: calculates the new score based on a number of points and the previous score value
 * title: drawPlayer
 * arguments: a color, x position, y position and size of the player
 * returns: void
 * description: sets the player color to the specified color, and it's position to x and y with size
 * hint: you can get very creative with your player! It doesn't have to be just a box!
 * title: moveUp
 * arguments: the current y position of the player, and the speed of movement
 * returns: the new y position of the player
 * description: moves the player up. If the player goes off the top of the screen, they should emerge on the bottom
 * hint: all of the move functions are essentially the same: you will add the two inputs and return the result
 * UNLESS the player has moved off the screen. If they have, you'll return the appropriate location.

} /** int moveDown(int y, int speed){
 * title: moveDown
 * arguments: the current y position of the player, and the speed of movement
 * returns: the new y position of the player
 * description: moves the player up. If the player goes off the bottom of the screen, they should emerge on the top

} /** int moveLeft(int x, int speed){
 * title: moveLeft
 * arguments: the current x position of the player, and the speed of movement
 * returns: the new x position of the player
 * description: moves the player left. If they go off the edge of the screen, they should emerge on the other side

} /** int moveRight(int x, int speed){
 * title: moveRight
 * arguments: the current x position of the player, and the speed of movement
 * returns: the new x position of the player
 * description: moves the player right. If they go off the edge of the screen, they should emerge on the other side

} code

if(touchedTarget(pPosX,pPosY,pSize,tPosX,tPosY,tSize)){