How to move left and right by tilting your phone left and right
http_gamesalad
Member Posts: 1,340
How would I do that?
How would I do that?
Comments
Hi @http_gamesalad you'd make use of the gyroscope. (Not me, haha) also called the accelerometer.
Here's a tutorial (quite old now but should still be relevant) showing use of the accelerometer in GSC.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
@gyroscope I see what you did there.. The thing is , is that why do we have to use self.postion.acceleromterY and not self.postion.acceleromterX? I never understood that... Cause the x axis goes left and right and the Y axis goes up and down
I've never understood that either... I guess it's because you're "pulling" the x axis down, the same for y, "pulling" it left and right....
Edit: the video below seems to use the x and y coords as you would think, so....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Here is another tutorial if you want to check it out. Its very similar but offers more responsive controls in my opinion. Both work fine though.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page