My Actor Slides across the Screen when its on the edge of a cliff? Help
RockstarBucks
Member Posts: 2
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.
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
Thanks for the suggestion, I just tried that and it still has the same issue. I'm wondering why the idle=true doesn't cause it to stop moving?
Every time i make on-screen controls it moves my character across the screen in mid-air and when i let go of the left or right button on the screen it just falls and then when i jump up and click left or right it just runs across the air until it hits the wall or i let go. Could someone help me with this issue please?
@hbrow86, You're actors are doing what you've told them too, but we'd need to see your rules/behaviors to offer any help. Below is a tutorial you might find helpful:
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page