Asteroids Starter Code

Get the starter code here (You should do a save-as on this link. Name the file Morphic-Asteroids.st.)

What we provide

We provide you with a chunk of code which will help you get started. This code implements a basic arcade game, and will set you in the right direction (hopefully). As a game, it works, but if you play it, you'll see that many snazzy features of real game are missing: score keeping, levels, asteroids that split when shot, UFOs, etc. You are of course free to start from scratch. If you understand this code should be easy to modify it implement other arcade games of the same flavor: Time Pilot, Galaga, Space Invaders, etc. Please note that this is not a "plug and play" project: even if you undertake the Asteroids project, you will have to understand and modify almost all of the code we provide in some manner.

The world, roughly speaking, consists of three entities. The player's ship, a collection of bad things (called blobs: asteroids, UFOs, UFO bullets, etc.), and a collection of good things (essentially this is just the player's bullets). While the world could consist just of a single collection of all of the things it contains, it turns out to be more efficient and slightly easier to conceptualize if we organize it this way. All objecs are submorphs of a toplevel morph called WorldMorph. We let the morphic framework classes gather events and step (update) each of the objects in our world.

The code we provide is broken down into the following classes:

Getting Started (Do this Soon!)

  1. First, download, open, and try the given code. You ought to be able to evaluate "WorldMorph test" in a workspace and play the game.
  2. When you get bored, start looking at the provided code. It's all in a category called "Morphic-Asteroids". Understand how it all fits together. Draw pictures of how the various objects relate to each other.

Making Changes

Once you've understood the provided code, you're ready to start extending and changing it. Make the game more/less realistic -- ships shouldn't just pass through asteroids. Make the game more/less violent -- add different kinds of weapons or turn the game into a civilization-style game, where asteroids are mined or colonized. Add other kinds of (smart) entities, such as UFOs, Klingons, etc. Think about ship health -- using bullets, shields, etc. should cause the ship's health to drop. Add new levels after the current one is complete. Make the game more efficient -- right now, collision detection is "very N-squared" -- data structure gurus will see real possibilities for improving the game in this area.