|
Hla, long time listner, first time caller ;) I am making a bejewel clone with a twist ;) for the android platform. But I am a little unsure how I get hold of the sprite after a finger touch. Time for some code. (snippet is from Update)
As you can see I need to get hold of the sprite which contains the selected gem, so I can highlight/animate/remove it. I though of putting the spirte into the Gem script as a public var or perhaps use an ID in the tag and run through all the sprites and find the corresponding sprite to the gameobject. But there most be an easier way.. :)
(comments are locked)
|
This will get you the Gem script of the object you touched. If you have a Sprite script attached to it do:
If the Sprite is a child of the Gem object I'd expose the sprite as a public variable or property of the Gem script. Thanx, I tried that before I posted yesterday, but I guess I most have been tired since I couldn't get it to work back then. I tried "(hit.collider.gameObject.GetComponent()).sprite.hidden = true;" just now, and it works like a charm..
Mar 16 '11 at 08:25 AM
AndreasBL
(comments are locked)
|
