Python Programming for the Absolute Beginner, 3rd Edition
It's time to return to the chapter project: the Astrocrash game. I plan to write progressively more complete versions of the game until it's done, but I still feel I need to list a few details of the program, including: the game's major features, a few necessary classes, and the multimedia assets the game requires.
Game Features
Although my game is based on a classic video game that I know well (and learned about the hard way, one quarter at a time), it's still a good idea that I write out a list of features:
-
The ship should rotate and thrust forward based on keystrokes from the player.
-
The ship should fire missiles based on a keystroke from the player.
-
Asteroids should float at different velocities on the screen. Smaller asteroids should generally have higher velocities than larger ones.
-
The ship, any missiles, and any asteroids should "wrap around" the screen—if they move beyond a screen boundary, they should appear at the opposite boundary.
-
If a missile hits another object on the screen, it should destroy the other object and itself in a nice, fiery explosion.
-
If the ship hits any other object on the screen, it should destroy the other object and itself in a nice, fiery explosion.
-
If the ship is destroyed, the game is over.
-
If a large asteroid is destroyed, two new, medium-sized asteroids should be produced. If a medium-sized asteroid is destroyed, two new, small asteroids should be produced. If a small asteroid is destroyed, no new asteroids should be produced.
-
Every time a player destroys an asteroid, his or her score should increase. Smaller asteroids should be worth more points than larger ones.
-
The player's score should be displayed in the upper-right corner of the screen.
-
Once all of the asteroids have been destroyed, a new, larger wave of asteroids should be created.
I decide to leave out a few features of the original to keep the game simple.
Game Classes
Next, I make a list of the classes that I think I need:
-
Ship
-
Missile
-
Asteroid
-
Explosion
I know a few things about these classes already. Ship, Missile, and Asteroid will be derived from games.Sprite, while Explosion will be derived from games.Animation.
Game Assets
Since the game includes sound, music, sprites, and animation, I know I need to create some multimedia files. Here's the list I came up with:
-
An image file for the ship
-
An image file for the missiles
-
Three image files, one for each size of asteroid
-
A series of image files for an explosion
-
A sound file for the thrusting of the ship
-
A sound file for the firing of a missile
-
A sound file for the explosion of an object
-
A music file for the theme
Категории