Side Scrolling Action Game

hello,

unfortunately it is a long time ago, but I once saw a very nice example of doing collision detection with bitmap images.

the point being that if you do not have some sort of geometry, it could be an interesting method. the project (I cannot link here, haha) dropped irregular forms from the ceiling, letting them fall onto the floor.
the nice thing was that it was working for any kind of form since it checked for pixels rather than distances and the like.

in fact, if you know the lowest pixel (or line of pixels) of your moving object, you do not need to check against your complete terrain but only against a smaller masked out part.

probably, if your moving object is not very regular you might need to check agains all its pixels, or, with some work involved the pixels showing its contour.

if the terrain is not too fancy, I think you could get away with limiting the pixels to detect collisions with to a small rectangle (from the highest to the lowest).

if any of your objects pixels is on a “black” pixel -> collision. you could use a contour too, but that may mean that you step over the boundary because your step size is too big.

so I think its fine to use contours for one object and the pixel area for the second - whichever.

maybe this helps to illustrate my strange words a little:

I know it is an not often used method for collisions, yet I like the beauty of it that it is independent of the form.

making an internal copy of your terrain in b/w should be easy.

if you have your object and your terrain in separate PGraphics, you could ignore colors completely and check on alpha values too.