Game Development Reference
In-Depth Information
Figure 5-27. Red rule
Updating the Asteroid
Open the Asteroid actor in the Actor Editor by double-clicking it. In the rule that
detects the collision with the Spaceship actor, remove the Reset Game behavior
by clicking the circled cross or by selecting and pressing Delete. Drag and drop
an Interpolate behavior and change the settings to:
Interpolate Attribute: game.EnergyBar
To: game.EnergyBarInit-25
Duration: 1
Function: Linear
This is where you use the buffer attribute called EnergyBarInit. If you were to
write EnergyBar-25, then you would go into an end-less recursive loop. Not
sure? Then let's put it on the iteration, like so:
Interpolation 0: EnergyBar = 100, to EnergyBar-25 = 100-
25=75
Interpolation 1: EnergyBar= 99, to EnergyBar-25=99-25=74
And so on, because every time GameSalad interpolates, the
target is also moving.
To finish the buffer trick, drag and drop a Time into the Spaceship Collision rule
and change the setting to ''After'' ''1.1'' seconds with ''Run to
completion''checked. Then drag and drop a Change Attribute into the timer and
 
Search WWH ::




Custom Search