How do I detect correct tilt

0 favourites
  • 10 posts
  • Hello Folks. Been trying to get my game working with the phone tilt controls.

    I want the game to be able to recognise head back(I don't know the answer) tilt and head forward(I knew the answer) tilt.

    exactly like the game Heads up for android.

    Im using Touch - Compare Orientation - Beta.

    I got Beta greater than 50 for the head forward tilt.

    and Beta less than -180 for head back tilt.

    Im not sure if those are correct to use cause they don't seem to do the job that precise. It does work but its not perfekt and it kinda needs to be perfekt so the player don't get the wrong result at finish.

    Hope someone can help me on this one.

  • Ok, I found this for best results.

    1 Restrict Beta by clamping it e.g Every Tick> Set YourVariableName to clamp(int(touch.Beta),-50,50)

    2 If YourVariableName >16 Simulate 8 Direction Pressing Down (or use Bullet)

    3 If YourVariableName <16 Simulate 8 Direction Pressing up (or use Bullet)

    Hope this helps

  • Ok, I found this for best results.

    1 Restrict Beta by clamping it e.g Every Tick> Set YourVariableName to clamp(int(touch.Beta),-50,50)

    2 If YourVariableName >16 Simulate 8 Direction Pressing Down (or use Bullet)

    3 If YourVariableName <16 Simulate 8 Direction Pressing up (or use Bullet)

    Hope this helps

    Could you demonstrate with an example (maybe a capx) ?

    Been trying to do what you said, but can't seem to make it work.

  • > Ok, I found this for best results.

    >

    > 1 Restrict Beta by clamping it e.g Every Tick> Set YourVariableName to clamp(int(touch.Beta),-50,50)

    > 2 If YourVariableName >16 Simulate 8 Direction Pressing Down (or use Bullet)

    > 3 If YourVariableName <16 Simulate 8 Direction Pressing up (or use Bullet)

    >

    > Hope this helps

    >

    Could you demonstrate with an example (maybe a capx) ?

    Been trying to do what you said, but can't seem to make it work.

    Is this what you are looking for?

    http://www.sizzle-games.com/Up_down/ Works on mobile only.

    If so here is the capx http://www.sizzle-games.com/up_down.capx

  • >

    > > Ok, I found this for best results.

    > >

    > > 1 Restrict Beta by clamping it e.g Every Tick> Set YourVariableName to clamp(int(touch.Beta),-50,50)

    > > 2 If YourVariableName >16 Simulate 8 Direction Pressing Down (or use Bullet)

    > > 3 If YourVariableName <16 Simulate 8 Direction Pressing up (or use Bullet)

    > >

    > > Hope this helps

    > >

    >

    > Could you demonstrate with an example (maybe a capx) ?

    > Been trying to do what you said, but can't seem to make it work.

    >

    Is this what you are looking for?

    http://www.sizzle-games.com/Up_down/ Works on mobile only.

    If so here is the capx http://www.sizzle-games.com/up_down.capx

    You're getting closer

    The idea is there, but its missing a resting point.

    Think of it as you're holding the phone to your forehead and when you nock forward it will be the correct answer and nocking backwards is the not correct answer.

    So when your head is straight, nothing should happen, which also means that there needs to be a bigger resting point so that people don't by accident give an answer.

    hope it makes sence.

  • Ok check this out.

    Is this what you are looking for

    Put sound on and volume up

    You have to be in resting position, screen facing out, and touch the screen for it to start, then tilt like the diagram.

    After tilting (answering)you have to return to resting position and touch again for another go.

    http://www.sizzle-games.com/heads_up_example/

    You would have to use some calibration to determine whether the phone is buttons up or buttons down, but it essentially will work either way.

  • Ok check this out.

    Is this what you are looking for

    Put sound on and volume up

    You have to be in resting position, screen facing out, and touch the screen for it to start, then tilt like the diagram.

    After tilting (answering)you have to return to resting position and touch again for another go.

    http://www.sizzle-games.com/heads_up_example/

    You would have to use some calibration to determine whether the phone is buttons up or buttons down, but it essentially will work either way.

    That's exactly what i'm looking for. Could you put your capx so i can get an idea of how this is done

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here you go.

    http://www.sizzle-games.com/headsup.capx

    Thank you Sizcoz. You've been a great help.

  • Nice, been trying to get it to work for so long, never could. Thanks sizcoz

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)