A remake of the classic arcade space shooter Asteroids.
JavaScript Processing Other
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 60 commits ahead, 96 commits behind APCSLowell:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore Create .gitignore Sep 20, 2015
AsteroidsGame.pde Score system fixes Dec 11, 2015
README.md Crosslink Nov 6, 2015
index.html Description, header, title for index.html Nov 6, 2015
processing.js initial commit Oct 17, 2014
styles.css initial commit Oct 17, 2014


Asteroids (Part 1)

Click here to see the program!

In this assignment we will start to replicate the old video game Asteroids. You will write a program that has a space ship that can be controlled with the keyboard. You will need to write a SpaceShip class. Your SpaceShip class will extend the Floater class, an abstract class that represents all things that float in space.

An abstract class is an "incomplete" class. It has abstract methods--incomplete methods that have no body. When your class extends an abstract class, you typically write the methods that are needed to "complete" the class. Note: To complete this assignment you will be writing two classes SpaceShip and Star. Do not modify the Floater class.

Suggested steps to complete this assignment

  1. Fork this repository.
  2. Uncomment the extends floater on Line 10
  3. Complete the 10 abstract set and get functions
  4. Write the Spaceship constructor. Make sure you initialize all 9 of the inherited protected member variables. You may find the Asteroids PowerPoint slides and the SpaceShip design worksheet helpful. You may also find this sample SpaceShip program helpful in understanding how the variables affect the SpaceShip's movement.
  5. At the top of your program, declare a variable of type SpaceShip
  6. Initialize the SpaceShip as a new instance of the class
  7. In draw() call the SpaceShip's show() function
  8. When you are happy with appearance of the SpaceShip, add a public void keyPressed() function to your program
  9. Write code in keyPressed that allows you to control the space ship with the keyboard. You must include the ability to rotate left, rotate right, accelerate, and enter "hyperspace." (There is no requirement for any fancy visual effects, hyperspace just needs to stop the ship, and give it a new random position and direction.)
  10. Add code to draw() to move() the Spaceship
  11. Finally, add a Star class that creates a random number of stars in random positions
  12. Note that for full credit, you MUST include instructions on how to operate your SpaceShip in the index.html file
  13. If you have extra time and are looking for a challenge, you might try to add an animation of "rockets" that appear from the back of the ship when you accelerate

These steps are only a suggestion. Your Asteroids game doesn't have to work or act like any other. Have fun and be creative.

Samples of Student Work


This assignment was selected as a "Nifty CS Assignment" in 2008 by Nick Parlante @ Stanford