I'm working on a tutorial about picking, because there are still many questions about it. I'm not that good at writing (and explaining), so it might take some time..
Here's a quick look at the rough draft:
How does picking work?
When first starting to work with construct 2 (and even for some of us working with C2 for a longer period) it can be hard to make actions that only affect the instances of an object you'd like to affect.
Let's start with the simplest event:
Bullet on collision with enemy ? enemy destroy
In this event it is clear that it is our intention to only destroy the enemy that is hit by the bullet and it works as expected.
In my understanding Construct 2 reads this line something like this:
Destroy each enemy instanc that is hit by a bullet.
Without undertsanding how picking works one of the first issues arrive when trying to destroy enemies when their healthpoints are low.
Let's have a look at these events:
(enemy has been given an instance variable ?health? set to 2)
Bullet on collision with enemy ? enemy subtract 1 from health
System compare two values : enemy.health < 1 ? enemy destroy
When testing these events with multiple enemies on screen, you will see that if you hit one enemy two times, all enemies on screen are destroyed. What is wrong here?
Basically the first event works as intended, 1 is subtracted from the enemy health variable of that instance only, much like the enemy destroy action mentioned before C2 reads the first event something like this:
Subtract 1 point from the health from each enemy instance that is hit by a bullet
So the trouble must be in the second event.
How does C2 interpret that event.
Check if the health from any enemy is lower than one, if so destroy all enemies.
But why?
This is because we haven't told C2 in the event which enemy we are talking about in the action following the event. No enemy instance is referenced in the event, so the actions apply to all enemy instances.
How to solve this?
The simple answer is: By telling C2 what instances should be affected by the action(s)
One way would be to make the system compare event a subevent of the collision event. We have seen that in the collision event the right enemy is picked so adding a subevent it's actions will be referencing the same instance.
Another way would be adding a system for each enemy as a condition to the second event. That way C2 will pick an enemy, test if the condition is true, act accordingly and pick the next instance and repeat the testing, untill all enemies have been picked and tested.
So with the for each event the instances are picked before testing the other conditions and as such the actions are related to the picked instance.
...