The Frontier: A Java Game
This
game
was
coded
in
Java.
It’s
a
single
player
game
where
the
player
tries
to
survive
as
long
as
possible
by
avoiding
being
hit
by
asteroids.
The
objective
is
to
collect
a
certain
amount
of
loot
objects
in
game.
It
was
originally
an
educational
Program
that
can
be
used
as
a
study
aid
for
students
ranging
from
grades
6
to
8.
The
program
teaches
students
about
the
planets
in
the
solar
system
and
allows
them
to
apply
their
knowledge
through
an
interactive
test.
It
was
made
in
2016
as a final computer science summative. *Note that not all of the textures used are my own.
Features
Menu
The
interactive
menu
system
uses
a
series
of
images
and
transitions
to
create
a
graphical
interface.
The
images
are
loaded
in
using
buffered
imaging
to
ensure
there
is
no
lag
between
transitions.
The
menu
is
navigated
by
using
the
arrow
keys
and
enter
button
on
the
keyboard.
This
is
done
by
using
the
KeyEvent
and
KeyAdapter
java.awt.event
library.
Source Code
To download the source code and try it for yourself visit my github
by clicking the link below.
For additional information email me at
OmidGhayouri@outlook.com
Database
The
database
option
in
the
menu
unlocks
after
the
player
collects
all
8
pieces
of
loot
within
the
game.
When
entering
the
database,
the
user
has
the
option
to
scroll
through
information
on
each
planet.
Here
they
can
prepare
themselves
for
the
test
section
of
the program.
Game Classes
The
game
consists
of
21
original
classes,
the
main
ones
being;
Player,
Camera,
bufferedimageLoader,
Animation
and
Textures.
The
player
class
takes
care
of
the
players
movement,
position
and
object
collision
with
the
map.
The
camera
class
is
what
controls
how
the
background
and
map
scroll
left
to
right
to
give
the
game
its
platformer
characteristics.
The
bufferedImageLoader
class
takes
care
of
loading
consecutive
frames
to
ensure
the
game
runs
smoothly.
The
animation
class
controls
all
of
the
sprites
that
contain
animations.
It
works
by
cycling
through
given
textures
to
create
a
loopable
animation.
Finally,
the
textures
class
is
where
the
sprite
sheet
is
divided
into
different
sections
to
create
the
individual textures for each object.
Collision Detection
Collision
detection
was
built
using
getBounds
and
physics.collision
functions.
The
getBounds
function
returned
the
x
and
y
boundaries
of
a
given
object
and
the
physics.collision
function
checks
if
the
boundaries
of
any
two
given
objects
intersects.
Depending
on
which
objects
are
colliding,
different
outcomes
occur.
For
instance,
asteroids
destruct
when
intersecting
the map or the player, and the player loses health if hit by an asteroid.
Health System & End Screen
The
score
system
incorporates
player
health
and
score
using
basic
counters.
The
count
is
triggered
by
the
collision
of
objects.
Once
the
players
health
count
reaches
0
the
game
enters
its
end
sequence.
Here
the
player
is
presented with the option to quit or return to the main menu.
Test Class
The
test
section
of
the
program
consists
of
multiple
choice
questions
built
using
a
basic
GUI
interface.
After
all
the
questions
are
answered
the
results
and
number
of
correct answers is displayed.
Omid G
2018