Game Development Reference
In-Depth Information
maxScore
: This is the maximum score for a blue circle. The maximum score decreases
as the circles' size increases. They have an inverse relationship. The smaller the circle,
the more points the player will score by clicking on it.
percent
:
This variable holds the current percentage of blue circles clicked. It's calculated
as
100 * (clicked / numCircles)
.
score
: This holds the player's score.
tempCircle
: Holding a reference to a
Circle
object, this variable is used in loops through
the circles array.
scoreTexts
: This variable holds an array of current on-screen score text messages. We
will create a custom class called
ScoreTextField
that will be used to create the objects
in this array.
tempScoreText
: This one holds a reference to a
ScoreTextField
class instance that will
be used in loops through the
scoreTexts
array.
textFormat
: The final game logic variable holds an instance of the Flash
TextFormat
class that will be used to format the text for the
ScoreTextField
instances.
These variables control the
game difficulty
:
circleGrowSpeed
: The amount a circle should grow in
scaleX
and
scaleY
on each frame
tick
circleMaxSize
: The maximum size for a circle on a level, which starts at 5 and goes
down to a minimum of 1
maxCirclesOnscreen
: The maximum number of circles on the screen at one time (so they
don't all get blasted on the screen in the first few frames)
numCircles
: The number of blue circles for this level
percentNeeded
: The percentage of blue circles clicks needed for the level
percentBadCircles
: The percent chance that a bad circle will show up on a frame tick
when trying to create a new circle
Defining the custom ScoreBoard elements
The
ScoreBoard
class was created in Chapter 2. It is a very simple class that allows for the
developer to place instances of the
SideBySideScoreElement
(also created in chapter 2) on to its
display list. You'll need to add the following custom elements to
ScoreBoard
:
SCORE_BOARD_SCORE
: The
scoreBoard
name constant in
Main.as
for the score display
scoreLabel
: Holds the label Score
scoreText
: Displays the current score
SCORE_BOARD_CLICKED
: The
scoreBoard
name constant in
Main.as
for the clicked display
clickedText
: Displays the
clicked
value followed by a slash (/) and the
numCircles
values, to indicate how many of the circles available in this level have already been
clicked
SCORE_BOARD_PERCENT_NEEDED
: The
scoreBoard
name constant in
Main.as
for the percent
needed display