Okay so I hope there is a way I can use the same object multiple times in a layout without having to create a clone.
Let's take for example a platformer. The player shoots a bullet to a crate. I gave the crate an instance variable of 100 health. Each bullet takes away 25 health. After 4 times the crate is ready to be destroyed and explode.
The way I have it coded (event / action):
...1 event & action - when bullet hits crate / it destroys the bullet and takes away 25 health.
...1 event & action - when the crates health reaches 0 / the crate is destroyed.
...1 event & action - on the create destroyed / the crate is destroyed. an audio is sounded. and an explosion animation is created.
This works fine when I have one crate. However, if I simply copy the crate and move it to later in the platform it is already destroyed because of the first crate. Is there a way around this? Perhaps by adding a condition that the UID is X crate? That way it will only take away health from that crate? Although I doubt that will work.
The only way I have found to have multiple crates is to just clone the crate and then make the same code for that crate. The problem here is that it takes up more space and memory to have those extra crates.
What is odd is that I have several food items. I can use the same fruit many times in a layout without cloning it.
I have it coded (event/action):
1 event & action - when player collides with orange / orange is destroyed & audio is played.
This however does not destroy all the oranges in the layout. Just the one the player touches. So in this case I do not need to clone the orange. I do not see the difference. I think I am missing something. Does it have to do with the instance variable? Should I give each create a unique instance variable? Any ideas?