SpriteCandy - collision check order (+ zdepth)

Blitz3D Forums/Blitz3D Programming/SpriteCandy - collision check order (+ zdepth)

LamptonWorm(Posted 2009) [#1]
Hi,

I need the collision checks (in particular checking if a point is inside a collision shape) to take into account the sprite z-order when using sprite candy.

At the moment if two sprites have different z orders but they overlap, collision affects them both if you hit the overlapping area.

I want it to only register the sprite that is in front of the other sprite (based on z-order).

I guess I need to create a z-ordered list of entities to check (I know how to get the z-order value from a sprite), and check in the right order, and if I hit one, exit the function/loop.

But that may be over the top - is there an easier way that I'm missing?

I don't want to create sprites on different layers, as that results in a ton of layers :) I guess SC has z-order designed only for rendering order, not collision check order by default.

Cheers,
LW.


Ross C(Posted 2009) [#2]
Aren't sprite candy's particles/sprites, all part of the one surface in blitz?


LamptonWorm(Posted 2009) [#3]
Hi,

I can set z-order of sprites on the same layer no worries, so they render as needed, but collision check order I think is in order of object creation, not z-order which kinda makes sense.

I think I have a workaround for now - I'll build a list of items being hit, order by their z-order value and only register a hit on the top (aka 'nearest') item.

Cheers,
LW.