Leap with accelerometer.

Discussion and feedback on Construct 2

Post » Fri Feb 21, 2014 7:57 pm

Good afternoon, I have a problem here.
I'm making a game for android where the character must dodge the objects that fall from the sky and I'm using the accelerometer to move. Also in the game the character to the screen precionar he jumps, then there lies the problem. Using the platform behavior when the jump happens that leap does not follow the movement toward what he is, the character simply leap at a right angle of 90 ° upwards. I wonder if using the accelerometer is to make that leap toward win continues along with the accelerometer and the direction he is taking the character.

For the keyboard it works normally.

Thanks! :D
B
26
S
6
G
4
Posts: 6
Reputation: 4,156

Post » Thu Mar 20, 2014 5:03 pm

If you are looking to have the player not move while on the ground, and is able to modify the direction while in the air:
Code: Select all
Player -> Is Falling
or
Player -> is Jumping
   Touch -> Orientation alpha > 30 ----> Player simulate move left
   Touch -> Orientation alpha < -30 ----> Player simulate move right


If you are looking to have the player not move while on the ground, and is NOT able to modify the direction while in the air:
Code: Select all
Global var jumpDirection = ""
Section for doing accelerometer jump you already have
   Touch -> Orientation alpha > 30 ----> Set jumpDirection = "left"
   Touch -> Orientation alpha < -30 ----> Set jumpDirection = "right"

Player -> Is Falling
or
Player -> is Jumping
   compare jumpDirection is "left" ----> Player simulate move left
   compare jumpDirection is "right" ----> Player simulate move right

X Player -> Is Falling
X Player -> Is Jumping  ----> set jumpDirection = ""


If you are looking to have the player able to move while on the ground
Code: Select all
   Touch -> Orientation alpha > 30 ----> Player simulate move left
   Touch -> Orientation alpha < -30 ----> Player simulate move right


You may need to change the 30 and -30 for the leap to be a different value depending on how the Leap handles. Anyway, good luck, and I hope this helps.
B
6
S
2
G
2
Posts: 16
Reputation: 1,153


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests