A classic Aircraft war game
This game is a classic aircraft war game, user controls a Hero aircraft to survive through enemy aircrafts. Enemy aircrafts are appearing from the top of the screen and moving downwards at random speed. Hero Aircraft will automatically firing bullet stright up and will destroy enemy aircraft once touch it. If hero aircraft collide with enemy aircraft, the game is over.
Background is one picture, by moving this picture at a constant speed from top to bottom, to achieve a flying effect.
Hero Aircraft will appear at the bottom of the screen, at a given coordinates. Monitoring the keyboard input, and given a speed (eg. 2px) to change Hero Aircraft coordinates accordingly if key <- or -> is pressed. Also, Hero Aircraft will be limited to screen pixel size to avoid Hero Aircraft move out of screen.
Enemy Aircrafts are created through sprite group, they will appearing at random corrrdinates from the top of the screen and moving at a constant (randomly from 2px to 5px). Same as Hero Aircraft, Enemy Aircrafts are limited in screen and not allow appearing from outside.
Hero Aircraft will automatically firing bullet stright up and bullet moving at speed of 3px.
When Bullet collied with Enemy Aircraft, Enemy Aircraft will be destoried. If hero aircraft collide with Enemy Aircraft, the game is over.
This project was completed by following the tutorial on Bilibili @黑马程序员
For more information, see "More Info"