Diagonal movement – move character in two directions simultaneously

In the previous post I showed you what fun effects can be produced by combining different scripts and running them simultaneously.
The ScratchJr app provides script blocks for four basic directions of movement – right, left, up, and down. If we, however move a character in two directions at the same time… it will perform a diagonal movement!

See for yourselves:

The trick is that the character runs two different scripts at the same time.

Diagonal movement – challenge

Once your students learn about this trick, challenge them to create an animation like this one:

First, you’ll need to create a background with a “track”.
Create a new background, and draw a square (remember to make it a square, no other rectangle will do!)
Next, choose the rotate tool and rotate your square by 45 degrees.

Once your track is ready, choose your favorite ScratchJr character and place it in one of the corners.
You might need to shrink your character a little.

Now, let’s move on to the most important part – figuring out the scripts.
The important thing is to decide the correct number of steps that your character should take in each direction (it’s NOT the same as the length of the sides of the square you’ve drawn).

The easiest way would be to use the grid tool.
Just show the grid, and count the number of steps:

Diagonal movement in ScratchJr.
Count the “boxes” of the grid to figure out the correct number of steps.

Your students might need a little trial and error before they figure out the correct order in which the blocks should be arranged.
Depending on the corner in which you placed your character, the order of blocks will be different.
End your scripts with the repeat forever block and make your character go on forever!

How did it go for your pupils? I hope they like it!

Happy coding!

Leave a Reply

Your email address will not be published.