Aircraft Game
Aircraft Game
classes and classes enable SDL to support cdrom, audio The main purpose of background music is to render
and video output, keyboard, mouse, and joystick input. the atmosphere and strengthen the overall appeal of the
Pygame is a game library created by using the SDL game. In this "airplane war" game, in terms of
library, which is used to develop Python program background music design, I learned and referenced many
modules for game software. Pygame is a library used by games, quoted different music in different scenes, and
Python. Pygame is a cross-platform Python module that applied different sound effects during the battle. The
focuses on the design of video games, including images, sound effects of a single bullet fired, and the sound
sounds, etc. based on SDL, allowing real-time video effects of double bullets after getting the props and the
game development. Based on this assumption, all main purpose of nuclear bomb sound effects is to fully
required game functions and concepts can be completely demonstrate the intensity of the entire battle process,
simplified into the logic of the game itself, and all thereby promoting the overall progress of the game.
resource structures can be provided by high-level Considering multiple factors and combining actual
languages [3]. needs, a relatively cheerful background music is selected.
IDLE (Integrated Development and Learning Part of the code is as shown in Figure 3:
Environment) has basic IDE (Integrated Development
Environment) functions. It is a very good choice for
noncommercial development. After the Python
installation is completed, IDLE will install it
automatically. The basic functions of IDLE: grammar
emphasis, paragraph indentation, basic text editing, table
key control, debugging program. IDLE is generally a
3.2 Design and Implementation of Enemy Airplane
standard Python release, and IDLE can be executed in an
Module
environment where Python and TK can be executed.
After opening IDLE, the interactive interactive prompt Set the flight status of the enemy airplane to a single
of enhanced interactive command line will be displayed, vertical downward moving flight trajectory, adjust the
and the menu is the "stripping" style of TK. In other flying speed of the enemy airplane according to the
words, click the dotted line of any drop-down menu at difficulty of the game, and call the random function to
the top to upgrade this menu to your own permanent make the enemy airplane appear at different positions at
window. IDLE's tester provides breakpoint, step and the top of the window randomly. When setting the
variable monitoring functions [3]. altitude, to prevent incomplete airplane or a sense of
This article uses many functions in the Python library abruptness when the enemy airplane is spawned, the
to realize the rapid development and design of game width and height of different enemy airplane are passed
content. The main function of the program mainly in during initialization, so that the height of the enemy
implements the definition of member functions and airplane is generated outside the frame, and the width is
member attributes, inherits related functions and adds generated between the width of the frame. Examples of
related game features, such as the realization of the enemy airplane are three types of airplane, large,
incremental function of scores, modules, loop detection medium and small, among which the large and medium
of various functions and monitoring game related events, types of airplane are given HP attributes [4]. The enemy
such as monitoring games the setting of superbullet airplane are divided into three categories: small, mid, and
events and delivery time, etc. and finally run the overall big, and load the width and height data of the enemy
program. Figure 2 below shows the program design airplane model to define the attributes of the enemy
process in detail: airplane's flight speed and number of generations, as
shown in Figure 4. Among them, when the enemy plane
performs collision detection, the blood volume is
reduced by 1. Design enemy airplane generation function
to generate enemy airplane into two sprite groups. One
group of enemies is responsible for collision detection of
all enemy airplane, and the other group is used to
determine the type of enemy airplane's reduction in
blood volume after collision, and pass the draw-line
function Draw bleed bar properties. Among them,
drawing the health bar needs to obtain the position
parameters of the enemy, and by detecting the blood
volume deduction value feedback ratio to achieve the
decreasing visual effect of the health bar.