A question about Adroid

Get help using Construct 2

Post » Fri Aug 24, 2012 10:27 am

Hello,

I have a question about android. With construct 2, i can make games, and save it as APK with Phonegap. The most android phones has the auto-rotate screen Technic. The auto-rotate screen Technic is used with some games, for example doodle jump. In that game, you steer to turn your phone to the left and the right.

My question is, can I use that in construct 2.

Thanks

(Sorry for my bad English)

B
6
Posts: 17
Reputation: 448

Post » Fri Aug 24, 2012 1:24 pm

You can access accelerometer values from the touch object.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Aug 24, 2012 3:46 pm

Thank you, i will read this page: http://www.scirra.com/manual/119/touch If i have questions, i post it here.



EDIT: Do you have a accelerometer example for me, or do you know where i can find them?jelmer112012-08-24 15:50:33
B
6
Posts: 17
Reputation: 448

Post » Sat Aug 25, 2012 9:11 am

Nobody has an example?
B
6
Posts: 17
Reputation: 448

Post » Sat Aug 25, 2012 11:12 am

This snippet is valid for landscape mode in phonegap 1.7 and below (tested personally). Newer versions of phonegap return random accelerometer data breaking your game. Appmobi treats accelerometer data in a different way, CocoonJS does not seem to have accelerometer support yet (@ludei am I wrong?).

global variable accangle = 0
global variable deadzone = 15
every tick -> set accangle to clamp(-int(touch.beta/10),-75,75)
accangle > deadzone -> simulate platform pressing right
accangle < -deadzone -> simulate platform pressing left

Note: this is a really basic implementation. You may try to adjust at runtime the speed of your charachter and make it dependent from the accangle variable, but I have to warn you... it's a tricky task. The main risk is that your control system will become framerate dependent ruining your gameplay.
B
11
S
3
Posts: 224
Reputation: 2,028


Return to How do I....?

Who is online

Users browsing this forum: spcsmrf and 15 guests