Class Asteroids

java.lang.Object
Asteroids

public class Asteroids
extends java.lang.Object
Asteroids.java - A clone of classic Atari arcade game Asteroids Algorithm:
  1. Create gamecontroller with public scope to give all objects access
  2. Load images and highscore, exit if error occurs
  3. Create game main menu with start and exit options
  4. If player selects exit skip to
  5. If player selects start clear menu and make game window
  6. Create three starting asteroids in game
  7. Put player at middle of screen
  8. Player turns with left and right, moves with up, and shoots with space
  9. Check all bullets for collisions with asteroids, skip to step if none
  10. Destroy bullet and asteroid and increment score
  11. Check all bullets for collisions with player, skip to step if none
  12. Destroy bullet and player and decrement lives
  13. Check all asteroids for collisions with player, skip to step if none
  14. Destroy asteroid and player and decrement lives
  15. If player lives reach zero, display game over message and return to step 3, updating highscore if necessary
  16. If player lives above zero, return to step 9
  17. Save high scores and terminate program
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int CANVAS_HEIGHT  
    static int CANVAS_WIDTH  
    static GameController gc  
  • Constructor Summary

    Constructors 
    Constructor Description
    Asteroids()  
  • Method Summary

    Modifier and Type Method Description
    static void main​(java.lang.String[] args)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait