Animations

In the last chapter you were introduced to animations. Here you will be introduced to different ways of creating animations:

Basic animations

If you add several images to a costume, you can animate them with

animate.

With the parameter loop you can specify if the animation should be repeated:

Multiple animations

Often a token needs several animations, which can also be called while another animation is still “running”. This goes e.g. like this:

costume_b = robo.add_costume(["images/b1.png", "images/b2.png", "images/b3.png"])
costume_c = robo.add_costume(["images/c1.png", "images/c2.png", "images/c3.png"])

# ...

@player.register
def on_key_pressed_s(self):
    self.animate(costume_b)

@player.register
def on_key_pressed_w(self):
    self.animate(costume_c)

Complete example

Examples