Any prolific SpriteCandy users?

Blitz3D Forums/Blitz3D Userlibs/Any prolific SpriteCandy users?

wmaass(Posted 2009) [#1]
I have several images that I have created as types using the HUD_CreateImage command. I can drag the images around the screen with the mouse and I want to know if an image has collided with another and I want to know what 2 images have collided. How can I do this using SpriteCandy's collision commands given that HUD_ObjectHitsObject can only check between to specific objects?

The type is like so:

type picture
field picimage
field picname$
end type

Then I create the types:

my.picture = new picture

my.picture = new picture

my.picture = new picture

Loktar(Posted 2009) [#2]
Looking through the sample code and trying to remember what I did I think you just have to loop through the objects real quick.

I would get the handle of the image you currently are dragging, and while its being dragged loop through the other images and do a objecthits check to see if they are colliding.

Check out Collision Shape Demo 1 to get an idea of how they do it.

wmaass(Posted 2009) [#3]
That will work, thanks a lot. I did not realize I could just get the handle of the picimage field of the object being dragged.

By the way there is an example in the demo source code where there are a bunch of asteroids flying around all colliding with each other. In the demo the asteroids are created in an array then the collision check is done in a loop...

For i = 1 To NUMCOMETS
For j = 1 To NUMCOMETS
...check collision here...

Any idea how this would be done if the asteroids were types?