Time for action — player acceleration

Now for the fun bit, and the most critical... the player movement!

  1. Double-click the Player actor to edit it. Click the Create Group button, and name it Movement. Make sure Group is selected; when it is, you can see a blue outline around it. If it isn't, select it. Now, click the Create Rule button and you should see a new rule within your group. If not, simply drag the new rule into it.
  2. Rename the rule to Acceleration and change the settings to: Attribute | game.Accelerometer.X |> | 0.5. This says that when the accelerometer on the X axis is greater than 0.5g, which means the device is in landscape and tilted forward.
  3. Now, add an Acceleration behavior, change the Direction to 90, and leave Acceleration at 100. Now would be a good time to limit the speed the player can get to, in the actors attributes box; expand the Motion roll out, change the Max Speed to 200, and check the Apply Max Speed box.
Time for action — player acceleration

What just happened?

We were able to utilize the power of GameSalad and the iPhone to use the device's accelerometer to accelerate our player in one simple rule! GameSalad just keeps getting easier!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.61.218