Look at this.
It does exactly the same as previous .cap. But with easier pick events.
You dont see the difference? OK lets walk you trough it.
Starting in the layout. There is only 1 tank in the layout. 1 base + its turret.
Both are in the same container.
You make a container by adding objects to it under the *groups* properties, and deeper *containers*
Why not name the container, as we name the families ?
Well that would be definably make containers easier to understand, but limit its possibility.
What can a container do for you ? It makes picking contained objects easier. Pick 1 object in a container and all objects in the container are marked as picked.
Lets see this work. Go to the events editor.
See event 2
Creating An object thats part of a container will create all the other objects in the container in an urge to keep the container complete.
As you see there is no action that creates a second turret.
When you create an object, that object will be marked as "picked"
Since the Base that we created is part of a container, and in that container is also the Turret, moving Turret will only move the Right turret, the one thats part of the container we just created.
See event 4
The loop walks trough the instances of object Base, and sets them picked one by one. But since base is part of a container that also contains a turret. The right turret instance will be set as *picked* too.
If we can pick the right turret based on picking the right Base, then only Base needs a identification number in a private variable. Turret does not need one no more.
see event 18
We pick an instance of Base by comparing one of its private variables to a value.
The variable is 'call_me', and this variable is holding the identification number for the instances.
The value is 'selected', a global variable, thats holding the number representing which tank is selected.
So it states: set the 'selected' base picked.
But since Base is part of the container that is holding the Turret, also the right Turret will be automatically set as picked.
So we can do actions for the right Base, and for the right Turret.
As you see, there is no conditions that tries to pick the right Turret. We have no idea anyway which turret is sitting on top of this Base, because we did not even give the turrets an identification number.
But the system knows because it knows in which container the Turret is sitting.
See event 20
We just picked the right Base, now we have the right Turret picked also. And the action will let the right Turret fire a bullet.
See event 22.
We only picked the right Base. Destroying this base will destroy all Turrets in that container.
As you see there is no action to destroy any turret.
Convinced to use containers? : )