Good Structure

Good Structure

When writing a computer program it is important that the program will always do exactly the same thing every time.

When a program is started, you do not want it to carry on from where it was last time, you want it to go back to the beginning.

To do this, it is important that you include instructions to clear away any data and drawings and that you reset the starting positions of your sprites. This is called initialising the program.

Watch the video below to learn about initialisation.

ScratchSequence.mp4

Draw a Square

Download the file from the bottom of the page and create a program that will draw a square with sides of 100 steps.

You might like to use the following blocks....

Make sure your program has a good structure:

  • Start

  • Initialise:

    • Clear the screen

    • Set the starting position and direction for the sprite

  • Draw the square

  • End the program

Press the Green Flag to see a demonstration.

(Press space to reset the program)

Key Words

Initialise

To get a program ready so that it will do exactly the same thing each time it is run.

Files

Below are the files you will need to complete the challenges.

How to Download the files and use them in Scratch....

...on a computer.

ScratchDownload.mp4

...on a smartphone or tablet

ScratchDownloadSmart.mp4