I made a transparent sprite who spawn one or more sprite.
Sprite instance generated have instance variables as a keyboard key (like 'R' for representing 'R' of the keyboard and a Red bullet on the player's screen)
Each time a sprite is spawn, i put the uid's sprite in an array
when a sprite spawned meets a condition that is too late for player for typping the key, i remove the uid in my array and i destroy the sprite (referenced by condition on Sprite)
A user's action can make destroy before meeting condition just explain before by typping the good key.
I want to destroy the first Sprite who correspond in my array to the key pressed.
this is a representation of my array when users press a key
[index] = uid of sprite
I have already made a loop on the array to find Sprite by uid and find the first Red Bullet sprite to destroy and then stop loop
My question is about how to find the first instance with key=='R' in their instance variable.
Can somebody explain or show me an example?
I check for uid documentation but i only found that uid is unique and defined at runtime now the way to get the Object behind an UID.
Thanks a lot!