O'Reilly logo

Corona SDK HOTSHOT by Nevin Flanagan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bridging physical events to game events

We now have physical events being passed in a very understandable format. We have a little bit of work left to do to translate these events (which are still specifically about the physical condition of the device) into commands for the player.

Getting ready

The math in this section is almost as abstract as the previous task, because the design specifies that the ship's acceleration is going to be based on how strongly the device's tilt aligns with the ship's facing direction, and the speed with which it turns will be based on how much the direction of tilt runs across the ship's facing.

Getting on with it

Save any other open files and open game.lua.

  1. Make sure the pythagorean distance module is loaded; we'll need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required