Scratch Programming
Using Coordinates
The Stage
The stage in Scratch measures 480 pixels wide and 360 pixels high. Coordinates in Scratch are based on the grid image below. This image is available to import as a background from the backgrounds that are provided when you install Scratch. Alternatively, save the image below and import that into any projects where you are struggling with coordinates.
Coordinates In Maths
Coordinates in Scratch work just like they do in Maths. You can try out this link at GCSE Bitesize to revise the topic,
http://www.bbc.co.uk/schools/ks3bitesize/maths/algebra/coordinates/revise1.shtml
Drawing A Square
In Scratch, we can get our sprites to draw on the Stage. Launch a new Scratch program and add the start and end blocks for a script.
To start the program, you need to add blocks to,
- Clear the screen of any drawings
- Lift the pen from the stage
- Move the Sprite to where we want to start drawing
- Put the pen down ready to draw
- Choose a colour for the pen
These blocks should look like the following image,
Now, moving the sprite will cause it to draw a line as it moves. We add 4 glide blocks to draw the 4 sides of our square and fill them in as shown in the screenshot,
You can test the program now or add the final touches now, a couple of blocks to lift the pen up and move the sprite to the centre of the stage or origin. The image on the right is how the stage should look when you run this script.
Adapt The Program
Download and copy the image of the grid into a graphics package. Make a sketch of how the stage would look with another, smaller square inside the one you have just drawn. Add the blocks you need to draw this square after the larger square has been drawn,
The Maze Challenge
Download the following Scratch program to start off this challenge,
The program loooks like this,
Your challenge: Adapt the program to animate the blue ball's journey from the start of the maze to the end. Use glide blocks for a nice effect. You could also get your sprite to draw the path it takes. Your sprite should not touch the walls of the maze as it travels.
More Challenges
- Write a program to create a line drawing of a triangle. Extend your program to draw the different types of triangle, right-angled, isosceles, equilateral and scalene.
- Write a program to create a line drawing of a robot.