Colliding with background objects

Previous topic - Next topic

kaotiklabs

Hi,

I was asking me if there´s any way to check for collision´s areas in the background bmp?

I will explain it a bit.

I want to load a background bmp showing a maze and dont want to load the walls as sprites.
Is possible to mark the wall areas as collidable in an easy way?

Thanks for the help in advance.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

David G

you could load a backround sprite and then make a mask for it.

Basically, you replace everything that you dont want to collide with and colour it RGB 255, 0, 128
then draw both image and do a SPRCOLL() with the mask  =D

Hope that helped

kaotiklabs

Hi David,

Thanks for your help. That´s what I need!  =)

The only think that Im not sure is about dealing with layers in GL.

Sprite layers are positioned by their invocation order? or there is a command to order them when they are overlaped?

Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Moru

There is no layers, think of it as MS-Paint where you draw over everything, you have to plan your pictures so you draw everything in the right order :-) Well I guess if you paint with oil on canvas you have the same trouble :-)

The DRAWSPRITE does just that, draws the sprite on the screen, next DRAWSPRITE goes on top of that. But the SPRCOLL doesn't draw any sprites, it just tests for collisions so you can just make a sprite with some lines where you want it to collide and leave the rest of the sprite with the transparency color.

Hemlos

Quote from: kaotiklabs on 2008-Jun-06

Sprite layers are positioned by their invocation order? or there is a command to order them when they are overlaped?



Background is a standalone layer, and the foreground is an editable layer. (sprites of course)
You can create a function to order your sprites into groups, along with building new sprites using USEASBMP
It can get complicated using images as layers, but wonderfully enough, it is possible to create your own.
Yes, it is invocation order, but you can create a function to order your sprites into groups, along with building new sprites using USEASBMP to emulate layers.
Keep in mind though...ultimately...invocation order.
Bing ChatGpt is pretty smart :O