I have 4 family members
- object type: sprite, name: asteroid
- object type: sprite, name: player
- object type: sprite, name: enemy
- object type: sprite, name: obstacle
all of this four have Health Points so i added HP variable to family.
Now: when enemy shoots to player i want to take 1 hp point from player's hp, but Player object has no HP variable - HP Family has it, so i have to detect collision between bullet and entire HP family. Now enemy bullets destroy everything, obstacles, asteroids, another enemies...
The question is: how can i detect collision between enemy bullet and player and take 1 point from it's HP family instance variable.
And second question:
since Family members can't contain other objects such as HP text object - i have to create Text object in for each loop through entire HP Members family, but I don't want to create text object for obstacles in this family, because it's not important to show how much energy obstacle has left. How can i remove only obstacle object types from this loop.
Any help will be appreciated