How do I detect correct tilt

Get help using Construct 2

Post » Fri May 12, 2017 1:22 am

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.
B
11
S
3
Posts: 31
Reputation: 814

Post » Fri May 12, 2017 10:42 am

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
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
48
S
14
Posts: 255
Reputation: 5,428

Post » Fri May 12, 2017 12:10 pm

sizcoz wrote: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.
B
11
S
3
Posts: 31
Reputation: 814

Post » Fri May 12, 2017 12:48 pm

Chansen wrote:
sizcoz wrote: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
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
48
S
14
Posts: 255
Reputation: 5,428

Post » Fri May 12, 2017 1:28 pm

sizcoz wrote:
Chansen wrote:
sizcoz wrote: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.
Image
hope it makes sence.
B
11
S
3
Posts: 31
Reputation: 814

Post » Sat May 13, 2017 9:49 am

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.
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
48
S
14
Posts: 255
Reputation: 5,428

Post » Sat May 13, 2017 9:42 pm

sizcoz wrote: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 :)
B
11
S
3
Posts: 31
Reputation: 814

Post » Sun May 14, 2017 5:49 pm

Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
48
S
14
Posts: 255
Reputation: 5,428

Post » Mon May 15, 2017 3:16 pm



Thank you Sizcoz. You've been a great help.
B
11
S
3
Posts: 31
Reputation: 814

Post » Mon May 15, 2017 3:27 pm

Nice, been trying to get it to work for so long, never could. Thanks @sizcoz
B
46
S
23
G
31
Posts: 693
Reputation: 20,637


Return to How do I....?

Who is online

Users browsing this forum: draiza, plinkie and 8 guests