Author Topic: Colliding with background objects  (Read 2586 times)

Offline kaotiklabs

  • Dr. Type
  • ****
  • Posts: 313
  • Spain is diferent
    • View Profile
Colliding with background objects
« on: 2008-Jun-05 »
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

  • Guest
Re: Colliding with background objects
« Reply #1 on: 2008-Jun-05 »
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

Offline kaotiklabs

  • Dr. Type
  • ****
  • Posts: 313
  • Spain is diferent
    • View Profile
Re: Colliding with background objects
« Reply #2 on: 2008-Jun-06 »
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!

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: Colliding with background objects
« Reply #3 on: 2008-Jun-06 »
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.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: Colliding with background objects
« Reply #4 on: 2008-Aug-07 »

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.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)