Accelerometer vs constrain position

RocketBrainRocketBrain Member, PRO Posts: 269

So i'm using the accelerometer to control the actor moving left and right across the screen and trying to use constrain position to limit the movement from going offscreen.

Rule: attribute game.accelerometer.x > -0.05
Move 180 relative to scene stacked
game.accelerometer.x * -1500

Constrain Attribute self.position.x = min(400,max(30,self.position.x))

and of course the same but negatives and reversed for the other direction

but the actor slides right off the edge into nothingness. What am i missing? As far as i can figure that should be correct.

Comments

  • RocketBrainRocketBrain Member, PRO Posts: 269

    oh and i'm testing on android in the portrait position.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    You won't be able to do it that way. Since you are using moveable just put walls on the edges and use collide behavior.

Sign In or Register to comment.