4/5H has recently looked at doing some coding in Scratch. Scratch allows us to control a sprite and make it do whatever we command it to. We have been working on commanding it to create some shapes. In order to do this, we have looked at how to find the internal angle of a regular 2D shape. This is done through a formula:
Inside angle = 180 - 360/n (where 'n' is the number of angles of the regular 2D shape).
For example: Finding the inside angle of a triangle
- Inside angle = 180 - 360/3
- 360 divided by 3 = 120
- 180 - 120 = 60
Therefore the inside angle of an equilateral triangle is 60 degrees.
We used the angles we worked out to draw the various shapes using a ruler and a protractor.
However, to create the shapes in Scratch, we need to look at angle relationships. Our Scratch sprite will head off in a straight line. If we were to turn it by the 60 degrees of the equilateral triangle, it won't make an equilateral triangle as it won't turn far enough and will actually make a 120 degree obtuse angle. As the sprite travels in a straight line, we actually need to know the adjacent angle in the straight angle. Therefore, we need to use the following formula to find the angle required to make a regular 2D shape in Scratch:
Scratch Angle = 360/n (where 'n' is again the number of angles of the regular 2D shape).
For example: Finding the angle to create a triangle in Scratch
- Scratch angle = 360/3
-360 divided by 3 =120
Therefore the angle required to create an equilateral triangle in scratch is 120 degrees.
The students then use the various coding commands to tell the sprite to make the shape:
A typical coding string of commands to create the equilateral triangle might look like this:
You can try an example here:
- Press the space bar to create a regular pentagon
- Press the up arrow to create a decagon
- Press the down arrow to create a triangle
Inside angle = 180 - 360/n (where 'n' is the number of angles of the regular 2D shape).
For example: Finding the inside angle of a triangle
- Inside angle = 180 - 360/3
- 360 divided by 3 = 120
- 180 - 120 = 60
Therefore the inside angle of an equilateral triangle is 60 degrees.
We used the angles we worked out to draw the various shapes using a ruler and a protractor.
However, to create the shapes in Scratch, we need to look at angle relationships. Our Scratch sprite will head off in a straight line. If we were to turn it by the 60 degrees of the equilateral triangle, it won't make an equilateral triangle as it won't turn far enough and will actually make a 120 degree obtuse angle. As the sprite travels in a straight line, we actually need to know the adjacent angle in the straight angle. Therefore, we need to use the following formula to find the angle required to make a regular 2D shape in Scratch:
Scratch Angle = 360/n (where 'n' is again the number of angles of the regular 2D shape).
For example: Finding the angle to create a triangle in Scratch
- Scratch angle = 360/3
-360 divided by 3 =120
Therefore the angle required to create an equilateral triangle in scratch is 120 degrees.
The students then use the various coding commands to tell the sprite to make the shape:
A typical coding string of commands to create the equilateral triangle might look like this:
You can try an example here:
- Press the space bar to create a regular pentagon
- Press the up arrow to create a decagon
- Press the down arrow to create a triangle
You can see the code that creates this by clicking here and then clicking on the See inside button once you are redirected.
What's our next step? We might look at creating some 3D objects with Scratch, and look at creating a game like the one below. You can give it a try too.
Use the arrow keys to move your spaceship and the space bar to shoot the starfish. Watch out for the special guided starfish that will follow your every move. Reach 200 points and you win. Enjoy!
What's our next step? We might look at creating some 3D objects with Scratch, and look at creating a game like the one below. You can give it a try too.
Use the arrow keys to move your spaceship and the space bar to shoot the starfish. Watch out for the special guided starfish that will follow your every move. Reach 200 points and you win. Enjoy!
Again, you can see the code behind this by clicking here and then clicking on the See inside button once you are redirected.