I’m using Platypus to make a platformer, and my player character uses platypus.move()
for horizontal movement since I’m controlling my own horizontal velocity with acceleration and friction.
The problem is, when I collide with a wall, I need to handle this velocity myself by setting it to 0.
I can do this with the WALL_CONTACT
message, but this only works on the first frame, so my velocity keeps going up after that initial collision. In my case I’m actually clipping through the wall because my chosen movement speed is too fast (if there’s actually a Box2D style “bullet” behaviour for dealing with this in Platypus that’s another workaround).
I can also do this with has_wall_contact()
which runs every frame, but because my character is colliding with the wall every frame, the character can no longer move away from the wall.
My idea is to check the direction of the collision, because then I can write code for both left and right inputs to handle this, for example if I’m moving into a wall’s left side, I can check to see if I’m still moving right to stop the player from moving, but allow the player to move left.
Is there a way to handle this with Platypus? Or is there another workaround that I might have missed?