You can draw the whole background to background layer but I still would chop it up so it internally does not have to check that many objects.
The other thing is that you normally should seperate your collision writes to at least 2 layers.
One layer where dynamic stuff that shall collide is written to (projectiles, actors etc) and one where the static stuff is like the tilemap etc.
reason is that you can use resetcollision on the dynamic layer on every frame and only reset the static layer when its position changes. Writing the collision is the time consuming part normally, not the reading part so the less often you have to write it the better for the end performance :)
One thing not used in all of these codes here is the fact that you can send an object in when writting the collision data to the layer. if another object then collides with it you will get that object back in the collision array instead of the TImage reference. Very powerfull when you write a little CollisionComponent and makes it very simple to get the "other" object in a collision reaction near instantly.
If you have a "physically" touched game thought using a polygon based physics system (there are a few for BM) might be better, as pixel perfect does not give you surface normals for example so a "bounce" reaction is near impossible if you do not restrict it to simple stuff like circles and quads.
The other thing is that you normally should seperate your collision writes to at least 2 layers.
One layer where dynamic stuff that shall collide is written to (projectiles, actors etc) and one where the static stuff is like the tilemap etc.
reason is that you can use resetcollision on the dynamic layer on every frame and only reset the static layer when its position changes. Writing the collision is the time consuming part normally, not the reading part so the less often you have to write it the better for the end performance :)
One thing not used in all of these codes here is the fact that you can send an object in when writting the collision data to the layer. if another object then collides with it you will get that object back in the collision array instead of the TImage reference. Very powerfull when you write a little CollisionComponent and makes it very simple to get the "other" object in a collision reaction near instantly.
If you have a "physically" touched game thought using a polygon based physics system (there are a few for BM) might be better, as pixel perfect does not give you surface normals for example so a "bounce" reaction is near impossible if you do not restrict it to simple stuff like circles and quads.