Shaking your phone
matthewadavid
Member Posts: 26
Can you set up an Action to happen when you shake your phone?
Comments
Use the accelerometer behavior, a few of boolean attributes, and a few of Timer, Rules, and Change Attribute behaviors.
Rule 1: If game.Accelerometer.Y > .5
--Change Attribute: game.ShookLeft = true
--Timer: After .4 seconds, run to completion
----Change Attribute: game.ShookLeft = false
Rule 2: If game.Accelerometer.Y < -.5
--Change Attribute: game.ShookRight = true
--Timer: After .4 seconds, run to completion
----Change Attribute: game.ShookRight = false
Rule 3: If game.ShookLeft is true AND game.ShookRight is true
--Congrats you have shaken the device.
I want to make a feature that when you shake your phone, the ball gets another direction, because sometimes it sticks between 2 walls in 90° ping-pong and you can't finish the game because of this.
how would you suggest to do the same thing with the same result, but to check if it works with the mouse or the keyboard?
or test on your device using gs viewer
I have to test it on the iPhone yet.
Thanks for the tutorial anyway! :-)