GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

My Actor Slides across the Screen when its on the edge of a cliff? Help

Hey Everyone,
I'm making a 2d action game with on screen controls that move the actor. Its going well so far, but I've been trying to figure out why my actor, which has collision behaviors with the ground and wall, when on the edge of a cliff, is sliding off and then continues to move in a constant x-velocity from the fall.

So I've figured it to be three actors that are involved in this reaction.
1) My Character
a) Collides with the ground and wall
b) no friction or bounce, and movable
c) If Attribute.idle=true, then self.velocity = 0
d) When no left or right key's are pressed, attribute.idle=true, else attribute.idle=false
2) The ground
a) not movable, no friction, no bounce
3) The Wall
a) not movable, no friction, no bounce
So with that, the character should never be moving, when no left, right input is being pushed. But on the edge my actor slowly slides off the edge. Which comes from my gravity (acceleration function) which is geared in 270 direction (south). I see where the X-component can come from a fall like this, but based on the idle=true, the character should not move.

If anyone has any idea, where my code has gone wrong, please let me know. I can provide more info if this is not clear enough. Thanks.

Comments

Sign In or Register to comment.