Now let's put it all together! In this activity, we will use Python code to animate Tobi walking across the Stage by switching between costumes and moving him step by step.

Setting Up
- Open PictoBlox and create a New File.
- Select Python as the coding environment.
- Make sure Tobi is on the Stage and has at least two walking costumes (Tobi Walking 1 and Tobi Walking 2).
- Set a backdrop of your choice — the Forest backdrop works great!
How the Animation Works
An animation is created by rapidly switching between costumes while moving the sprite. We will use a loop to repeat the costume switch and movement many times, creating the illusion that Tobi is walking.

Writing the Script
Type the following Python code in the editor:
import time # Set starting position tobi.go_to(-180, -80) tobi.point_in_direction(90) tobi.set_size(60) # Walking animation loop for i in range(30): tobi.switch_costume("Tobi Walking 1") tobi.move(8) time.sleep(0.1) tobi.switch_costume("Tobi Walking 2") tobi.move(8) time.sleep(0.1)
Understanding the Code
Code Breakdown
Running the Script
- Click the Run button to execute the code.
- Watch Tobi walk smoothly across the Stage!
- Try changing the range(30) value to make Tobi walk further or shorter.
- Try changing time.sleep(0.1) to make the animation faster or slower.


.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)