Ball heading set by phone turning on a flat surface (or not)

Hello,
I am trying to make a game and I hit a snag.
I want:

  1. the ball to head off in a random direction. (Works)
  2. keep track of score/highscore the latter being persistent. (Works)
  3. When the ball hits the edge of the canvas, end the game and track the scores(s). (Works)
  4. Rotate the phone to change the heading of the ball, so you can delay it hitting the wall. (This is what I need help with)
  5. Future stuff - Difficulty levels, and changes in speed.

Regarding my issue, I tried all of the sensors (Gyro, Accel, etc.), But I can't figure out how to get the ball to maintain it's heading when the phone is turned. The best I got was heading changed by tilting the phone.

If anyone has an idea of what I am doing wrong, please tell me.

Baller.aia (28.8 KB)

Off the top of my head, have you tried the compass?

I don't see a compass. Is that part of something else?

I found the navigation component. I'll try that.

nope

Thanks. I used the Azimuth return from the Orientation Sensor. I took out most of the random stuff and just made the ball's heading equal the Azimuth.

You got me going in the right direction. I'll post my finished app when it is.

1 Like