Scratch Silver III
Scratch Silver II
SCRATCH SILVER I
SCRATCH GOLD III
1 of 3

2.05 Improved movement

The dragonfly ‘glitches’ and changes direction really fast if the mouse-pointer is touching the dragonfly. You will check another condition to fix this.

Select the Dragonfly and find the script that starts with when flag clicked.

Drag an if inside the forever block and the blocks inside the forever will move inside the if.

Check carefully that your code looks like this:

Then drag a not block into the if and a touching (mouse-pointer) inside that.

Check that your code looks like this:

The not block turns a condition into its opposite, just like it would in a sentence.

Test: Check that the glitch is fixed, and the Dragonfly only moves when it is not touching (mouse-pointer).

A different condition to try is:

This makes the dragonfly move when it’s far enough from the mouse-pointer.

Tip: You can drag blocks anywhere in the Code area and leave them there while you try different things.

×
×

Cart