Game Development Reference
In-Depth Information
As you want to capture intended movement and not vibration, you select the
trigger value of 0.05. You may play around this value to find the one you feel
most comfortable with.
Let's modify the Right Movement rule to include the accelerometer condition. In
the Right Movement rule, add a new condition:
''Attribute''''game.accelerometer.X''''>'' ''0.05''. You also need to change from
''All'' to ''Any''as in ''When 'Any' conditions are valid.'' That's it! Your new rule
will be similar to Figure 4-23.
Figure 4-23. Right Movement rule with accelerometer
If you change from Portrait to Landscape orientation or to support both
orientations, you will need to change your accelerometer rules.
Create a group of behaviors for the racket by clicking Create Group in the Actor
Editor for the Racket. Drag and drop the two rules into the group.
The rules that you just created work well for Portrait orientation. You need to
inverse them for the Portrait Upside Down orientation. Doing so is very easy with
GameSalad. Create a rule that will detect the screen orientation and enable the
correct rules accordingly.
Create a new rule with the conditions of ''Attribute''''game.Screen.Device
Orientation'' ''is'' ''Portrait.'' Then drag and drop the newly created group. The
new rule should be as in Figure 4-24.
 
Search WWH ::




Custom Search