Game Development Reference
In-Depth Information
The formula will ensure that you will have analog acceleration. It's linked to the
value of the accelerometer axis, so the stronger you move, the faster it will go.
Repeat the previous steps three more times.
Duplicate the rule you just created by holding the option key while dragging
down the existing rule. Name it ''right.'' The condition of the rule is
''attribute''''device.Accelerometer.Y''''>''''0.1.'' Then drag and drop an
Accelerate behavior and change the settings to:
Direction: 180
Relative to: actor
Acceleration: max(100, min( 1400, abs(
device.Accelerometer.Y * 1000)
The rule is shown in Figure 8-3.
Figure 8-3. Right Accelerometer rule
Create a new rule and name it ''down.'' The condition of the rule is
''attribute''''device.Accelerometer.X''''>''''0.1''. Then drag and drop an
Accelerate behavior and change the settings to:
Direction: 90
Relative to: actor
Acceleration: max(100, min( 1400, abs(
device.Accelerometer.X*1000)
 
Search WWH ::




Custom Search