Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

4. Résolution du bug

Transcript

Your interactive graffiti game is working almost perfectly, but there’s one problem.

When you click the green flag, you’re also pressing down on the mouse, so the sprite stamps even though you only meant to start the program. This video will show you how fix this error, or bug, and prevent this from happening.

Add a “wait” block, and set it to a very short time, like 0.2 seconds. Place it at the beginning of the code just after the “clear” block, so the script waits to run until after the green flag has been clicked. Bugs are common in any code that computer scientists write. It is important to test your code often so that you can find the errors before your users. Bugs in your code are a chance for you to learn and become an even better computer scientist, so don’t worry when you find them.

Now, it’s your turn! Prevent the spray paint sprite from stamping when the flag is clicked by adding a “wait” block.

arrow_backward Retour
Suivant arrow_forward
Instructions
Utilise un bloc "Attendre" pour corriger le bug.