Game Development Reference
In-Depth Information
Adding Advanced Features
It's now time to add a few advanced features to your game. You will learn some
mathematic aspects to create complex movements and movement visual
effects, manage an energy bar with the Interpolate behavior, and transition the
scene with the Change Scene behavior.
Complex Movements
You can open the file Carrot_Invaders_step1.gameproj to follow the steps from
this point.
Mathematics is fun! I am pretty sure that most of you won't believe me, but I can
assure you that the math required for game development is really basic and it
lets you make fun games!
By now you must have hit the Preview button and destroyed the carrots. And
you manage to destroy them quite easily: still, defenseless targets! But what if
the carrots could move? They would be less easy to kill. As you have guessed
by now, you will use mathematics to define their movements.
Before you jump into the movement definition in GameSalad, I would like to
clarify what I mean by ''complex movement.'' A complex movement is not a
random movement. A random movement is chaotic by its very nature. A
complex movement has a very pre-determined pattern but is different from a
simple linear movement.
Parametric Equations Are Fun
So fasten your seatbelt and jump into the world of parametric equations.
Basically a parametric equation is a way to draw a graph with an equation where
both the X and Y position depend on a specific parameter. It means that every
point in the drawing of the graph is a couple of coordinates (X,Y). At this point,
you should say ''ah ha!'' Yes, GameSalad represents the location of the actors
with X and Y coordinates. For example, Actor1's position on the screen is X=0
and Y=0. This is the bottom left corner of the screen.
Let's go one step further. Imagine that instead of having a fixed value (0,0) you
have a parameter that varies over time. Let's call this parameter ''t.'' Now you
can define the position by X=t and Y=t. The result is that your actor will move in
a linear movement in the top right direction. The t parameter could be, for
example, a number incremented by 1 every seconds or maybe a clock.
Search WWH ::

Custom Search