DEPARTMENT OF COMPUTING

CS 1410 | Syllabus | Assignments | Schedule | Canvas Course | [print]

CS 1410: Asteroids Part 2

Nearly everyone has played or at least heard of the famous arcade game Asteroids. But, if you have not, you can play it here. The game involves a player-controlled spaceship that can turn left or right, accelerate forward, and shoot bullets. A collection of rocks (asteroids) move through space, potentially on a collision course with the spaceship. If a collision between the spaceship and a rock occurs, then the spaceship is destroyed. If a bullet collides with a rock, the rock and bullter are both destroyed. The objective of the game is to eliminate all of the rocks, by successfully shooting them from the spaceship, before a devastating collision incident occurs.

Assignment

Your assignment is to recreate a simple Asteroids game using Python and Pygame. The assignment will consist of two sequential parts. For this second part, you are required to add implementions the following features of the game:

  1. A bullet must fire from the ship and travel in the direction the ship is facing at the time. The bullet will only stay active for a limited amount of time after being fired. Then, it should disappear.

  2. Collisions between any rock and the bullet will cause the bullet and the rock to disappear.

  3. Collisions between any rock and the ship will cause the game to end.

  4. All rocks being destroyed will cause the game to end.

  5. Stars will be displayed, and they will twinkle, becoming brighter and dimmer.

For part 2 of the assignment, only the above additional functionality is required. You are welcome to continue working on additional features once you complete the requirements for part 2, but it is your responsibility to complete the requirements for part 2 of the assignment first, and submit it by the due date.

For this assignment, you are required to demonstrate use of the object oriented principles inheritance, polymorphism and aggregation when implementing the classes that have been designed for you to represent the game and its various components.

You should use your solution to part 1 of the assignment as a starting point.

Part 2 Unit Tests

Required Classes

The required classes are listed in the UML Diagram. Not all of the methods will be described in detail here. For example, most getter methods will not be listed. However, if they are in the UML diagram, they are required. If you have questions about the required functionality, please ask questions in class or in the discussion forums.

Only changes to part 1 classes are listed here.

This browser does not support PDFs. Please download the PDF to view it: Download PDF.

Movable Class

Movable Data Members

Movable Methods

Rotatable Class

Rotatable Data Members

Rotatable Methods

Polygon Class

Polygon Data Members

Polygon Methods

Ship Class

Ship Data Members

Ship Methods

Rock Class

Rock Data Members

Rock Methods

Circle Class

Circle Data Members

Circle Methods

Bullet Class

Bullet Data Members

Bullet Methods

Star Class

Star Data Members

Star Methods

Asteroids Class

Asteroids Data Members

Asteroids Methods

main

Hints

Last Updated 09/27/2019