How do I - Use tilt to control ball direction

Get help using Construct 2

Post » Sat Aug 29, 2015 6:35 pm

Hi...In my game I have a bouncing ball on screen. I want to move ball left or right using device left or right tilt. I looked at other posts and used this code. It is working but in opposite directions. If I tilt device toward left then ball goes towards right and viceversa.

Please help in correcting the code.

if touch gamma orientation > 0 , then, set 8 direction vector X to touch.accelerationXwithG*64

if touch gamma orientation < 0 , then, set 8 direction vector X to touch.accelerationXwithG*64
B
7
S
1
Posts: 19
Reputation: 466

Post » Sat Aug 29, 2015 6:42 pm

what is the camera type in-game?? example : top view, or side view etc
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Sun Aug 30, 2015 2:08 pm

Top view
B
7
S
1
Posts: 19
Reputation: 466

Post » Sun Aug 30, 2015 7:07 pm

ok then u can try making this :
if touch gamma orientation < 0 , then, set 8 direction vector X to touch.accelerationXwithG*64

if touch gamma orientation > 0 , then, set 8 direction vector X to touch.accelerationXwithG*64

just change the greater than and less than sign....
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908


Return to How do I....?

Who is online

Users browsing this forum: David181, evillair, Fenix18 and 50 guests