|
CS152, Fall 2020
Computer Programming Fundamentals
Home
Schedule
Syllabus
Style Guidelines
Assignment 10: Game
Part 1 (50 points) due: Monday November 23 by 9:30am
Part 2 (100 points) due: Wednesday December 2nd by 9:30am
Description
Create an interactive game. The game should include one or more targets that a character or "sprite" chases. A score counter shown on the screen should keep track of how many targets the sprite has hit. The targets should always be moving around. When the sprite touches one of the targets, the targets and character should react (by changing color, for example), the score should increase, and the target should disappear and then reappear in a new location. This assignment is worth 150 points in total.
The monster and ball programs we worked through in class might be useful for this assignment. See also the following Java documnetation: Graphics and Key Listener.
Requirements
Your project should include all of the elements below.
- The sprite should consist of at least 5 different primitive shapes (ie: ovals, rectangles, etc.) and lines.
- Your sprite should be controlled using the keyboard. You can choose the keys that move the sprite up, down, right, and left.
- The sprite should not be able to move off of the screen. If it "falls" off the screen in one direction, it should appear on the other side of the screen. i.e.: if it falls off the left side of the screen, it should reappear on the right side.
- The targets should always be moving.
- There should always be at least one target on the screen that the sprite can catch.
- Create at least three different classes, a main "game" class along with one for the sprite and one for the targets.
- Your program should use the structure and code we have gone over in class to set up the screen and event listeners for your game.
- Create an appropriate background/setting for your game to take place in.
- The game score should be drawn on the screen.
- When the sprite touches one of the targets, the targets and sprite should react (by changing size or color, for example). It is OK to calculate "touching" by using the "bounding sphere" or "bounding box" of your sprite and targets. You do not have to be exact here.
- When the sprite touches one of the targets, the on-screen score should increase.
- Your game should be personal and fun. You are encouraged to use many of the concepts we have covered in class in creative ways. You are also encoraged to create a game that is more complex than the one described here.
- Include the appropriate source code header.
- Include comments above each method that inlcude @param statements for every parameter.
- Carefully read and follow the course Style Guidelines.
- Extra credit (5 points). Your game should include the following additional functionality:
- A way to have your sprite lose energy and ultimately die. :'(
- The game should include more than one level. That is, you should be able to "win" level 1, be notified of that success in some way,
and advance to level 2
- Level 2 should have a different background from level 1.
- The score counter should be reset to 0 for level 2.
- You should be able to "win" level 2 and be notified of that success.
What to Hand in for Part 1:
- Program outline in code. Turn in all of your .java files. Your program at this point should conisist of: classes, variable definitions, method definitions, and comments. It should not include code beyond the basic structure. There should be no code inside of your methods. Your program outline code should compile.
- A paragraph or two about your code. Submit a paragraph that describes how your program is organized and why. Include a description of how your game will work when you've finished writing code. Finally, include a discussion of your experience working on this assignment. What challenges did you encounter? How did you address them? What did you learn?
What to Hand in for Part 2:
- Your completed program. Turn in all of your .java files.
- A paragraph or two about your project. Submit a paragraph about your game. Include links and citations for any materials you used to design and code it. Include a brief discussion about your experience working on this assignment. How did focusing on code organization first help you develop your game? If you did not feel that organizing your code first was helpful, describe your experience. What other challenges did you encounter? What did you learn?
|