News:

Function Finder  Find all the functions within source code files

Main Menu

Bird-eye solution for fading sprite/object

Started by Adaz, March 25, 2006, 08:48:48 AM

Previous topic - Next topic

Adaz

Hi,

I need a solution for the following problem:
I have a sprite (e.g a sphere) and an object (e.g. a gate) on a bird-eye platform. How can I solve the fading problem among this two?

I've drawn some small images to demonstrate it. (Attached)

Thank you in advance!

[attachmentid=568]

[attachmentid=569]

[attachmentid=570]

[attachmentid=571]

Ádáz

Hungary

kevin

In this situation you will have to assign your objects an order of precedence.    Which is nothing more than a fancy way of saying that you assign the special Z (depth) to your sprites based upon their position in your map.

To do this, you could use a simple rule.  Where the X + Y   cords are multed out to calc the scene depth of the sprite in question.  

Z = (ScreenHeight-Ypos) * ScreenWidth    ; Calc the Row depth
Z= Z+(ScreenWidth-Xpos)   ; Invert the Xpos and depth ot the depth

This will mean the sprites lower on the screen with have precedence over higher ones. Plus, Objects will have Right to left precedence along each row.  So if two sprites are on the the same row, the right hand sprite will have precedence since it's Z value will be lower.

Above i've used Screen coords, but that's probably overkill, you could prolly use map coords just as well.

For objects like the archway,  this object would need to be becomes 2 sprites.  The Left side & the right side.   Then it's just business as normal

Adaz

Kevin, thank you!! You are a real genius...
I've begun programming 20 years ago, but this problem took 4(!) weeks to me to *almost* solve...
thanks again!! ;)

Ádáz

Hungary

kevin

I should say, that the above method is untested.  But It should work .. :)

Big C.

Please, could you program an example so that I understand the theory? Listen to himself interestingly...  :)