Getting Started Guide
SCRATCH CODING KIT
Mole game coding activity
Mole game activation
Mole game activation coding
First, let’s make a code that activates the game when the IR sensor connected to digital port 3 is pressed.
The initial sensor value of digital port is “false”. The sensor value changes to “true” when the user presses the IR
sensor.
Using this do the coding saying “when digital 3 sensor value = true, activate the game”.
Make a script by dragging the blocks as shown above.
The first block means that the script will be activated when the flag icon is clicked. The ‘infinite repeat’ block below
that means that it will infinitely repeat to check the script in this block.
There is ‘waiting’ block inside the ‘infinite repeat’ block. As we know, this block waits until certain condition is met,
and that condition will be “digital 3 sensor value = true” in this case. Which means, when the IR sensor of digital
port 3 is pressed and digital 3 sensor value becomes true, it will move away from this block and go on to the next
direction.
Then the coding above means “when the flag icon is pressed, I will wait until the IR sensor connected to the digital
port 3 is pressed”.