Game Development Reference
In-Depth Information
In fact, this isn
t even going to be an in-depth exploration of those
topics because they really aren
t necessary for most casual games.
In this chapter, we will cover the foundational concepts you
need to understand to be able to handle a wide variety of chal-
lenges involved in game development. We will accomplish this in
two parts: Geometry and Trigonometry, and Physics, each with a
practical example illustrating the concepts. If when you
re done
with this chapter, your appetite is whetted for a more in-depth
look at these topics, I have provided links to further reading on
this topic
s Web site.
The Math Class
ActionScript includes a core library for performing a lot of the func-
tions we
re going to learn about in this chapter. It is the Math class,
and it will quickly become invaluable as we get into more compli-
cated problems later on in our code. It doesn
t include everything
ll learn about some companion
functions we can write to make it even more useful.
ll eventually need, but later we
Part One: Geometry and Trigonometry
Geometry, specifically Euclidean geometry, is the branch of mathe-
matics that deals with, among other things, the relationship
between points, lines, and shapes in a space. From it, we derive
the formulas for finding the distance between two points, as well as
the entire x - y coordinate system (known as the Cartesian coordi-
nate system) on which Flash
s Stage is built. Figure 11.1 illustrates
a typical two-dimensional coordinate system.
s coordinate system is slightly different in that it is flipped
over the x-axis ,resultingin y values being reversed. The upper-left
corner of the Stage is at (0, 0) and expands down and to the right
from there, as shown in Fig. 11.2 . This is important to note because
it is diametrically opposed to the notion that numbers decrease as
they move
on a graph, and it can cause confusion later
when we move into some of the concepts of physics.
Trigonometry (or trig for short) is a related, but more specific,
branch that describes the relationships between the sides and
angles of triangles, specifically right triangles (triangles with one
angle of 90
). All triangles have some fundamental properties:
A triangle
s interior angles always add up to 180
Any triangle (regardless of orientation and type) can be split
into two right triangles.
The relationships between any given side and angle of a triangle
are defined by ratios that are known as the trigonometric
functions .
Search Nedrilad ::

Custom Search