Game Development Reference
In-Depth Information
only one side is shrinking. Alternatively, you may constrain the position at the
same time the size decrease, but this would consume many more resources.
The next step is to constrain the width of the Energy Bar to the EnergyBar
attribute. This way, the Energy Bar actor width will be the real-time value of the
EnergyBar attribute. If the EnergyBar attribute goes from 100 to 75 by
interpolation, then you will have a visual effect of the Energy Bar actor shrinking.
Drag and drop a Constrain Attribute into the Energy Bar actor and change the
settings of Energy bar.size.width to game.EnergyBar.
The behaviors you just implemented should be as per Figure 5-25.
Figure 5-25. The Energy Bar behaviors
Now let's create the color changes.
From Green to Orange to Red: Managing Energy Bar Color
Create a new rule named ''Orange'' with the following condition:
''attribute''''game.EnergyBar''''<''''75.''Then drag and drop an Interpolate
behavior and change the settings to:
Interpolate attribute: Energy bar.Color.Red
To: 1
Duration: 1
Function: Linear
Drag and drop a second Interpolate behavior and change the settings to:
Interpolate attribute: Energy bar.Color.Green
To: 0.5
g
 
Search WWH ::




Custom Search