How do I make a Accelerometer Canon?
Hello
How do I make a Accelerometer Canon? But specific place on top of the scene on for portrait iphone.
thank you
How do I make a Accelerometer Canon? But specific place on top of the scene on for portrait iphone.
thank you
Comments
How do you make an accelerometer cannon . . .
Fill it with accelerometers!
EDIT:
By the way, if you want to get "down" (meaning the angle the accelerometers say points to the center of the earth), it would be
(vectorToAngle( game.Accelerometer.X , game.Accelerometer.Y )+90)%360
The '90' is to compensate for the device being in landscape orientation. If you want it in portrait mode, just take the 90 out.
Hope that helps!
Sorry RKS, your joke went over my head!
I got a black screen with this
Make a cannon actor. The actor's image should point exactly to the right.
Place the following behavior in the cannon actor:
Constrain Attribute: self.Rotation To: 90 + (vectorToAngle( game.Accelerometer.X , game.Accelerometer.Y )+90)%360
Be sure to use the drop-down menu in the expression editor to get 'self.Rotation', 'vectorToAngle', 'game.Accelerometer.X', and 'game.Accelerometer.Y'. Don't just type them into the expression editor.
Hope that helps!
did not work, does also have to do with image?
The image does not matter. (Try it with a blank actor. But make it 'face' to the right. Just as it is when it is dragged onto the scene.)
I'll need more feedback than "did not work." Can you describe what is not working?
so i can see exactly what to do
thanks
Hmmm.... are you testing it on a IOS device?
http://speedy.sh/4xnQh/LevelFinder.zip
I'll tell you what. You can help dondan89 if s/he wants to know what to do when the cannon angle passes through the "360 to 0" border and starts firing the shots in the wrong direction.
http://speedy.sh/8MsKe/LevelFinder.zip
http://www.speedyshare.com/file/WzPQf/rockkk.gameproj