T
That BioMechanical Dude
Guest
I'm making a Physics-based platformer and I encounter the following issue: when the player object moves left and right, while in mid-air, and bumps into a wall, it slides on that wall, which slows down the object's falling speed. It's probably because of the nature of the physics engine. The object has some horizontal velocity, which pushes it against the wall, causing it to slow down. I don't want this behavior, so I change the code for when the player presses left or right:
However, a new problem arises. The player object can't move left or right when on it's on the ground (which is also obj_wall), only when it's in mid-air, and I think I know why. When using x and y for collisions, GML takes the whole collision mask (or in this case, fixture) into account (so that x+1 would be one pixel to the right of the entire object, not just the origin). The function obviously checks if certain objects are overlapping and indeed, after making the fixtures visible, I can see that the bottom of the player object overlaps with the top of obj_wall.
So, is there a way to fix this? Some other function I can use to check for a collision? Please let me know.
Code:
if !(physics_test_overlap(x+phy_speed_x, y, phy_rotation, obj_wall)) {
physics_apply_force(x, y, 110, 0)
}
So, is there a way to fix this? Some other function I can use to check for a collision? Please let me know.