Game Development Reference
In-Depth Information
You will use decrementation, so you need a buffer attribute in order to avoid a
recursive endless loop (I will show this later in the implementation).
Create a new actor and double-click it to open the Actor Editor.
Edit the actor attributes with the parameters in Table 5-8.
Table 5-8. Energy Bar Attributes
Name
EnergyBar
Size/Width
100
Size/Height
10
Color/Red
0
Color/Green
1
Color/Blue
0
Physics/Moveable
unchecked
In order to have perfect positioning on the screen, change the position attributes
of the actor with some Change Attributes behaviors.
NOTE: about positioning the actor
You will have notice that I often use Change Attribute behaviors to
position the actors. It gives an impeccable result. It consumes a very
little bit of memory but the impact is very negligible. You may want to
use another approach, which is to change the position attribute of the
actor instance by double-clicking the actor instance on the scene.
Drag and drop a Change Attribute behavior into the actor and change energy
bar.Position.X to 0. Drag and drop a second Change Attribute behavior and
change energy bar.position.Y to 20.
Positioning the actor to X=0 will only display half of the actor on the screen. This
is done intentionally. As you modify the size of the actor, it will keep its center
position but reduce from both left and right side. By creating an actor double of
the required size and making only half visible, you will create a visual effect that
 
Search WWH ::




Custom Search