The bounce isn’t noticeable to the eye, you can’t spot it.
But it is there, cause the output terminal says that the character is moving up, it’s a really small bounce, that always lasts for 4 frames (at 30fps).
How do I know when the character is moving up? I’m using a function similar to the one that you’ve helped me with when I was looking for ways to check if the character is moving down. (the function that makes character.prevY- a made up variable same as character.y- actual y value , and then compares them, and when character.y is smaller or larger than character.prevY, it detects).
That function is okay though.
Yes, character does have .isFixedRotation = true.
The jump animation is triggered when the character moves up, and only allowed when the player hits the jump button, and the character is standing on the ground.
However, if the character bounces up, and if the player hits the jump button right at that time, the animation will trigger, but the character won’t jump.
It’s a glitch that I noticed when I was playing around with the game on my phone.
Yes, I will most likely fix this by adding some boolean variables (true/ false), but I’d rather get rid of this bounce, as it will most likely give me more problems in the future.
-
Your player moves down to the tile at a fast speed
-
The tiles don’t have enough force to counteract the player (only half of his physics body is on the tiles)
-
He penetrates into the Box2D shape a bit
-
The next frame, he has to be moved out…
-
So he accelerates slightly upward
I remmeber this was happening all the time, before I started using tiles. When my character was just walking and jumping on a rectangle that was serving as ground. I can’t remmember what were the physics properties of that rectangle though.
Can I get rid of this bounce by changing physics properties of tiles or character’s body?
Increase the density of tiles or something?