There are three classes used to represent our invaders:
Out of these classes, only
Alien inherits from
Actor because it is the only entity that is drawn and collides with other objects. Instead of a static image, the sprite will be a basic animation wherein each image will be shown for 0.5 seconds. This is achieved by loading an
ImageGrid and creating an
Animation from this sprite grid. Since these classes belong to the
pyglet.image module, we need to import them first.
Another function of our aliens will be notifying its column that the object has been removed. Thanks to this, the column of aliens knows what the bottom one is and starts shooting from its position.
You learned from the CocosNode reference ...