Smooth Accelerometer Use?

T8TRG8TRT8TRG8TR Member Posts: 120
edited December 2011 in Working with GS (Mac)
I'm working on a game and I need the accelerometer to let the player smoothly move from left to right kind of like Doodle Jump. I'm having problems making the movement feel smooth.

Any tips?

Comments

  • SparkyidrSparkyidr Member Posts: 2,033
    This is what I have set up in a game I am working on at the mo, and it feels really smooth to me.

    for left movement :
    When game.accelerometer.x < -0.01
    Constrain : self.motion.linear.x to -(game.accelerometer.x*800)

    For right movement, change the <-0.01 to >0.01

    Depending on the orientation of your phone, you might need to swap around the > and < rules, and the minus around the constrain.

    Also, the "800" is how fast it feels, so change that to get different effects, also, try setting a max speed in the actor that you are moving, so it never gets to silly speeds.
  • T8TRG8TRT8TRG8TR Member Posts: 120
    Thanks! I think that sounds much better than what I'm doing ATM
  • SparkyidrSparkyidr Member Posts: 2,033
    Also. You can up the 0.01's to have more of a "dead zone" before the motion kicks in.
Sign In or Register to comment.