Get an object by position

Hi guys,

In my game, I have 4 objects placed in a square. I’m shooting a bullet from the screen center towards one of the objects (randomly).

When the the transition (shooting) is complete I determine the bullet position in my listener function by using bullet:localToContent(0,0). Is it possible to use the returned x and y values to get the object that has the same x and y properties as the bullet?

Thanks!

Jaap

I don’t think there is any function to get an object based soley on coordinates. You would need some form of collision detection. You can either use physics (which might be overkill for your app) or make your own.

Thanks Vince! Physics probably is overkill, I will give the non-physics collision detection a try.

I don’t think there is any function to get an object based soley on coordinates. You would need some form of collision detection. You can either use physics (which might be overkill for your app) or make your own.

Thanks Vince! Physics probably is overkill, I will give the non-physics collision detection a try.