Game Development Reference
In-Depth Information
Background Rules and Behaviors
The background contains a couple of Change Attribute behaviors that will be
used to perfectly position the actor at the center of the screen.
Open the Background actor in the Actor Editor. Create a new group and name it
''Position the background.'' Drag and drop a Change Attribute behavior in the
group and change Background.Position.X to 240. Repeat the operation with an
additional Change Attribute behavior and change Background.Position.Y to 160.
The group is shown in Figure 8-7.
Figure 8-7. Position the background
Open Door Rules and Behaviors
You need to open the door that blocks the access to the winning hole. The
player has to move the ball over a button that will trigger the opening of the
door. The button works as an on/off button. This means that if the ball touches
the button, it will open the door. If the ball touches the button again, it will close
the door, and this cycle will continue.
In the Open Door actor, you will detect the collision with the Ball actor. This will
trigger a change in a Boolean game attribute. Depending on the value of the
previous attribute, the door will move from one position to the other. But, in
order to have time to move the ball off the button before it hits the button again,
you need to add a timer of 2 seconds. If you don't use this timer and let the ball
keep moving over the button, it will keep changing state from true to false so
quickly you won't even notice it by eye.
Create a new game attribute of type Boolean and name it ''Open Door.'' Open
the Open Door actor in the Actor Editor. Create a new actor attribute of type
Boolean and name it ''Timer.''
 
Search WWH ::




Custom Search