Main forum > GLBasic - en

Not wanting pixel perfect collision

(1/2) > >>


I've drafted out a retro platformer (basically manic miner) and have an animated player but I'm finding that the pixel perfect collision is causing problems when my character walks off a wall. As he gets to the end of the wall he falls down as expected. However, as his arm extends back beyond his feet, the arm collides with the wall and the character sticks.

If I place a rectangular box under the sprite and use that for the collision then I don't get this problem as the edges of the collision check are always uniform (i.e. nothing sticking out past the edge to catch the wall).

Is there a way to replace the pixel perfect collision with a bounding collision instead? Or to make my rectangular box invisible so that it can't be seen but still detects collision.

Hopefully I've explained this clearly!! :S

Many thanks,


if I didn't get it wrong, I'd do this:
I would place the rectangle on the player without DRAWRECT and check the collision with BOXCOLL
Ad maiora

Thanks for the reply Qedo,

I was thinking about BOXCOLL but didn't think I'd be able to check its collision with a sprite or anim.

I think I've sorted it! Keep using the box sprite for the collision, but not actually drawing it to the screen seems to work!

You could also use the array for the map data instead of the sprite/box collision. Just convert the screen coordinates of your player and compare to the map data to decide of there is a collision or not. This should also have the added benefit of being pretty fast compared to sprite collision tests.

Example of what I mean:

That manic miner looks really nice btw :)


[0] Message Index

[#] Next page

Go to full version