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

2.04 The handwheel puzzle

In this step, you will create a puzzle where a handwheel needs to be turned.

The scripts for this puzzle are quite similar to the button puzzle, so you can copy those scripts over and then edit them.

Drag the two scripts you created for the button sprite on to the handwheel sprite, to copy them to that sprite.

The when flag clicked script is the first one that needs to be changed.

Create a new variable called handwheel turned, and use that variable instead of the button pressed variable.

Choose: Change the completion number to whatever you would like it to be. We chose 3 in the example.

Like a real handwheel, the handwheel sprite will only be able to turn a small number of degrees at a time, so the angle it has been turned will need to be stored.

Create a new variable called turned and set it to 0 when the game starts.

The handwheel sprite.

Now you can edit the when this sprite clicked script, so that when the handwheel sprite is clicked repeatedly it turns a small amount each time until it completes a full revolution. When it has completed the right number of full turns (3 times in the example), the puzzle will be solved.

Add blocks so that each time the handwheel sprite is clicked, it turns 15 degrees and the turned variable increases by 15.

The handwheel sprite.

Test: Move the Monet sprite (or your character sprite) close to the handwheel and then click on the handwheel sprite. It helps to be in fullscreen mode, so that you can’t drag the handwheel sprite around.

When the turned variable reaches 360, then the handwheel has been turned once; this can now be stored in the handwheel turned variable.

Use a nested if to change the handwheel turned and reset the turned variables. A nested if is when one if is placed inside another.

Test: Move your character sprite close to the handwheel, and then click on it. You might have to adjust the distance that the character needs to be from the handwheel.

The handwheel sprite.

Tip: You can click and drag your Monet (or character) sprite around, to bring it closer to the handwheel, for instance. This will save you time, as you won’t keep on having to use the controls.

×
×

Cart