I have gone through the accelerator sample code, but could not figure how to detect only the four directions up, right, down and left.
Anyone can share code? [import]uid: 6661 topic_id: 12532 reply_id: 312532[/import]
When you say “detect only 4 directions” - what exactly do you mean?
Do you want a character moving only up, down, left and right? Or do you want to know which was the device is being held to effect other things on the screen? (For example if it’s tilted up, spawn something, print something, etc?)
[import]uid: 52491 topic_id: 12532 reply_id: 45775[/import]
Yes, I want a character moving only up, down, left and right like in pacman. [import]uid: 6661 topic_id: 12532 reply_id: 45782[/import]
Right, OK, well then use the standard tilt controls but simply set it up so that if the character is already moving up it cannot move left or right, etc.
As in, if the device is tilted to the right set Y motion in action and cancel out any X movement. [import]uid: 52491 topic_id: 12532 reply_id: 45888[/import]
Hi Peach, what do you mean by standard tilt control? I looked at the online docs but cannot see any reference to tilt controls. What are the corona api I should use to call these controls? [import]uid: 6661 topic_id: 12532 reply_id: 45941[/import]
API here; http://developer.anscamobile.com/content/game-edition-box2d-physics-engine
Tutorial here; http://techority.com/2010/11/19/control-an-actor-with-the-accelerometer/ [import]uid: 52491 topic_id: 12532 reply_id: 46069[/import]