Dock – automatic binding in the Kivy language
You might realize from previous chapters that the Kivy language does more than simply transform its rules to Python instructions. For instance, you might see that when it creates properties, it also binds them.
Note
When we do something common such as pos: self.parent.pos
inside a layout, then the property of the parent is bound to its child. The child always moves to the parent position when the parent moves.
This is usually desirable but not all the time. Think about solo_attack
of the invader. We need it to break formation and follow a free trajectory on the screen. While this happens, the whole formation of invaders continues moving from right to left and vice versa. This means that the invader will receive two orders at the same time; one from the moving parent and another from the trajectory's Animation
.
This means that we need a placeholder (the dock) for each invader. This will secure the space for the invader when it comes back from executing...