FORGE
for further details on how we put this together and
connected it to the Arduino.
The inspiration for this project comes directly
from our previous tutorials, where we used the
screen to show a sideways-scrolling representation
of changes in temperature over time. Sideways-
scrolling backgrounds like this are a traditional game
mechanic, used in classics like the original Defender
from 1979/1980, and Super Mario Bros. But the
game we’re most inspired by for this project is called
Scramble, from 1981. In Scramble you needed to fly
your ship across a cityscape before entering a series
of tunnels. These tunnels became a mini game in
their own right as you tried to position your ship in
the best part of the screen to navigate impossible
turns and an ever-decreasing tunnel height. It’s this
part of Scramble we’re going to loosely emulate
with our own Arduino game, adapting the scrolling
temperature chart we’ve already created into a
tunnel. But to start with, we need to get the joystick
controls working, and for that we need to be able
see (and control) something on the screen.
SHIP SHAPE
Many of the earliest games used simple geometry
to represent a spaceship. One of the best known is
Asteroids, which used an augmented triangle as the
main craft for the player to control, with degrees of
rotation and thrust. This was because the screen
used a ‘vector’ display that could only draw lines
from one point to another. We haven’t suffered the
same restrictions since raster-scanning cathode ray
tubes became commonplace, and flatscreen modern
technology made it all but a distant memory. But
vectors like these are still used when you want an
image to scale, or when you don’t have the memory
for more than two colours, and they’re the basis for
modern scalable graphics like SVG and 3D polygons.
Thanks to the Adafruit graphics library, it only takes
a single command to draw a
triangle (or a rectangle,
or a circle – filled or
empty), and we’ll
revisit the idea when
adding some stars
to our game. But for
now, we’re going
to use a bitmap for
the ship, another
Many of the earliest games
used simple geometry to
represent a spaceship. One of
the best known is Asteroids,
which used an augmented
triangle as the main craft
”
”
PICKING A BOARD
MEMORY
ARDUINO TYPE
Duemilanove (2009) UNO Rev3 Mega Mega 2560
Flash 16 kBytes 32 kBytes 128 kBytes 256 kBytes
SRAM 1024 bytes 2048 bytes 8 kBytes 8 kBytes
Below
The KY-023 module
uses a joystick
very similar to
a PlayStation 2
controller joystick,
which can also be
extracted and used in
the same way
Left
One of the main
differences between
each version of the
Arduino hardware is
the amounts of both
flash memory and
SRAM available