|
I have an iPhone game that involves destroying objects by touching them. When I touch an collidable object, it is destroyed. However, if these objects are stacked (I have many such objects being spawned at once), it destroys all of the objects that are on the spot that one touches. All objects are moving around in x,y space, they all have a z of zero (it is a 2d game). How do I make the game only destroy the topmost item (they have a z of zero, but objects look as if they are on top of one another) instead of destroying all of the objects when I touch a spot? If it matters, I am using the FingerManager from the forums to dictate my 'touch' action.
(comments are locked)
|
|
Sounds like you need to destroy the touched object and then set a bool flag that will not allow any further touch destruction(s) until TouchPhase.Ended is reached (i.e. finger lifted).
(comments are locked)
|

Going to be hard to help you without knowing how you're deleting your objects in the first place. Blind guess: are you deleting objects every frame your finger is down instead of the first one?
I was using 'destroy.'