Wednesday, June 8, 2022 6:16 PM
Introduction
1. Definition of the project
at. States
The chosen project is an action-shooter game
coded in java.
The game is a simplified version, because it
needed to meet the constraints of the
assignment, of fundamental principles of
object-oriented programming.
b. Plan
The game initializes with a simple interface
where the player is asked to input their
name. Then the player chooses the fighter-
jet and the desired difficulty level. The game
is then initialized, with the player moving the
fighter-jet to the right or to the left, and
forward or backward, utilizing the ‘direction’
keys, to escape adversary fighter-jets and
their missiles, player fighter-jet missiles are
fired using the ‘space’ key.
A scoreboard at the top right displays the
current score, play difficulty level, and the
number of player lives remaining, and this
information is depicted as images at the
bottom left.
The difficulty level changes depending on the
achieved score, so that if the score is greater
than or equal to 1000, the difficulty level
goes from 1 to 2, and the adversary fighter-
jet speed increases; so that if the score is
greater than or equal to 2000, the difficulty
level goes from 2 to 3, and the adversary
fighter-jet speed increases further, until the
highest difficulty level, when the command
adversary fighter-jet appears.
In a randomized manner, various kinds of aid
are provided, in the form of increases of
capability, which can be in the form of,
double missiles capability, triple missiles
capability, protection against adversary
fighter-jet missiles, and increased player life.
2. Specifications
Our program must offer these features:
Profile management: if the player has already
played on the game, he chooses his name
and the application is responsible for
creating a new game for him, otherwise he
chooses a name and the player will be
registered on the database.
Traceability: all the players as well as their
games and the best score achieved in each
game.
GameBoard: after selecting the name of the
player, the latter must choose the plane
(attack, agility, number of lives) as well as the
level (intermediate, high level ...).
Enemy planes: it depends on the level of the
player, we display different enemy planes
(speed, type of enemy).
Missile fire: the plane must fire missiles at
the enemies.
Collision detection: if the enemy plane
(respectively the missile of the enemy plane)
to hit our plane we must reduce the number
of remaining lives (after three strikes).
InfoBoard: we must display the name of the
player, his score, level, as well as the number
of lives remaining.
PowerUps: a powerUps is displayed each
time in a random way which can be either an
addition of life, firing a double missile, firing
a triple missile, protection against enemies.
SFX: the firing of missiles, PowerUps, the
passage from one level to another is
characterized by a special sound effect.
Performances: we have tried to make the
game as efficient as possible in terms of
memory consumption as well as the speed of
the game (Threads).
Analysis and design
The game is initialized by, imputing the the
player’s name, the difficultly level, and the
desired fighter-jet.
In the instance that the ‘New Player’ option
is chosen, a TextField will be provided for
player name input, otherwise the already
existing name is chosen.
Source code :
- View layer:
Figure 2 a new player
Figure 3 selecting a player
Figure 4 Assigning Player Name to TextField
Figure 5 Processing the TextField
The already existing list of players must be
loaded, so that in the constructor, a method
call occurs.
Figure 6
the click of the ***** button loads the list of
players
Figure 7
Instantiation of the player and the game
occurs with loading of the list of existing
players
PlayerService and PartService.
(Figure 7).
Figure 8:
then the instanceStartingClass () class is
invoked, which initializes the game with the,
display of the player fighter-jet, display of the
adversary fighter-jets, etc.
- Service layer:
For reasons of implementation of the MVC
architecture, the controller is represented in
our project by the package service which is
used to receive all the events of the view and
initiates the actions to be performed.
Figure 9
create () and findAll () service layer
- Dao layer:
b. Aircraft movement
The player fighter-jet movement occurs using
the, up, down, left, and right arrow keys, so
that the
Figure 10: the keyPressed () method
and
Figure 11: the keyReleased () method
That Utilize the, up (), down (), moveLeft (),
moveRight (), stop() methods, changes the
position of the player fighter-jet, changing
the position, by utilizing the update ()
method.
Figure 12: whileAvionIsAlive () method
to remove adversary fighter-jets when they
go off of the screen, is the task of the
removeEnemiesOverLimitte () method.
vs. Collision detection
The idea is to draw a rectangle around each
object and check after the intersections of
the rectangles to detect a collision.
The size of the rectangle takes the size of the
object that we want to detect its collision but
the coordinates depend on the various
coordinates ie they are fixed in the method
update ().
The method checkCollision () allows you to
manage whether a collision has been
detected or not.
Figure 13 checkCollision () method
d. The explosion of enemies
When a projectile hits an enemy, the enemy
must explode and remove from the list of
enemy aircraft.
Figure 14 destroy () method
e. Enemies follow you
From level 3 the enemies follow the plane.
Figure 15 Follow () method
- The development is huge (in terms of
processing) and we could not integrate all
the processing done in the project because
each function depends on a large number of
other functions which makes the integration
of the explanation into the report a little
delicate.
7. Final result
The game begins with a simple interface of
choosing the aircraft and the player's name
as well as the level.
Figure 16 GameBoard Interface
Figure 17 GameBoard with animations
The game interface is characterized by an
InfoBoard at the top right on which the
score, the name of the player and the level
are displayed.
At the bottom left, the number of remaining
lives is represented by a number of images of
the plane.
Figure 18 Level 1
In the event of an enemy explosion an
animation occurs.
Figure 19 Enemy explosion
From level 3 the enemies start firing
projectiles and their movement speeds
increase.
Figure 20 Firing projectiles by the enemy
The appearance ofenemy boss is done little
by little with a display of a bar at the bottom
right which displays Health of the enemy
Boss.
Figure 21 Entrance of the BossEnemie
The explosion ofenemy Boss:
Figure 22 Enemy Boss explosion
The PowerUps:
When the game has finished, a ’GameOver’
indication is displayed, in a window, that
displays the score the player achieved, with
the name of the player.
Conclusion