0 Favourites

Leap with accelerometer.

  • 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!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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:

    Player -> Is Falling
    or
    Player -> is Jumping
       Touch -> Orientation alpha > 30 ----> Player simulate move left
       Touch -> Orientation alpha < -30 ----> Player simulate move right
    [/code:4yjj569z]
    
    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:4yjj569z]
    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 = ""
    [/code:4yjj569z]
    
    If you are looking to have the player able to move while on the ground
    [code:4yjj569z]
       Touch -> Orientation alpha > 30 ----> Player simulate move left
       Touch -> Orientation alpha < -30 ----> Player simulate move right
    [/code:4yjj569z]
    
    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.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
38 6,809
leegj's avatar
leegj
Topic
0 Favourites
Set Axis & Accelerometer
14 1,810
EyezWidee's avatar
EyezWidee
Topic
12 757
mutuware's avatar
mutuware