I am becoming desperate about a problem, I have with bullet collisions on instances of family objects. First of all, here is a screenshot of my creation in action:
Nothing special, as you can see: A Top-Down-Shooter.
The world is randomly created. At time, I have created two families for the creation of the foliage:
Inside are different sprites. Each sprite shall have different properties. In my particular problem: I want to assign random health-points variables to each instance, via giving the whole family an instance variable:
family instance varibale name: hp
value: random(5, 10)[/code:3vc5p7fp]
When the health-points drop to zero, the object instance, I was aming on, shall be destroyed.
In my main event sheet, I included the following "lines of code":
[code:3vc5p7fp]on created -> fam_foliage_rocks -> set value -> fam_foliage_rocks.hp -> random(5, 10)
spr_bullet -> on collision with fam_foliage_rocks -> subtract from fam_foliage_rocks.hp -1
system -> every tick -> compare value -> fam_foliage_rocks.hp "less or equal" 0 -> destroy[/code:3vc5p7fp]
[li]Every instance of fam_foliage_rocks objects now have the same randomly assigned health-points.[/li]
[li]If they drop, all instances of the objects, belonging to fam_foliage_rocks will be destroyed.[/li]
The game will be filled with a lot of more objects / families and stuff to interact with. Because the stuff should mainly be randomly generated, I will be encountering this problem very often. I searched the tutorials, forums and a lot of external results, but still haven't found a proper solution.
[li]How can I assign random variables for every instance of family objects?[/li]
[li]How can I affect (destroy) only a specific instance of family objects?[/li]
I hope you can help me out.