Game Development Reference
In-Depth Information
Now you will add boundaries to the left and right sides. It will be a minimum of
240 and a maximum of (1440-240) for the x-axis value. Drag and drop two
Constrain Attribute behaviors and change:
CameraControl.Position.X to
max(240,CameralControl.Position.X)
CameraControl.Position.X to
min(1200,CameralControl.Position.X)
This is shown in Figure 7-48.
Figure 7-48. CameraControl behaviors
Last but not least, uncheck the visible attribute, which is located in the actor
attribute for this actor.
Enabling Level Selection
You now need a way to be able to click on a box to play an unlocked level. You
will use a very simple trick. When you touch to slide, the Touched and Released
position will not be the same. But if you intend to click a box, the Touch and
Release position will be the same.
Create two game attributes of type real named ''TouchedX'' and ''ReleasedX.''
You will use those attributes to store the value of the Touch and the Release.
Next, open the BoxLevel actor prototype in the Actor Editor.
Create a new rule with the condition ''Actor receives event'' ''touch'' is
''pressed.'' Then drag and drop a Change Attribute behavior in the rule and
change game.TouchX to devices.Mouse.Position.X, as shown in Figure 7-49.
 
Search WWH ::




Custom Search