Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help with Scratch simple draw triangle loop

Hi everyone,

I'm starting with Scratch with this script to draw triangles wich so far I made it correct, but now I would like to improve my script by setting to change side length by 10 everytime a new triangle is draw. Eg: set to draw one triangle side length will be 10; set to draw two triangles first will have sides length 10 and second will have sides length 20; set to draw three triangles first will have sides length 10, second will have length 20 and third will have length 30; and so on…

The next triangle will be drawn 20 steps away from the top corner of last triangle

I have tried setting side as a variable but never made to change side properly, if anyone could amend my script would be great please!

Script below:
 

define sides

move (10) steps

 

when [space] key pressed

set [no of triangles] to [3]

repeat (no of triangles)

  pen down

  turn ccw (60) degrees

  sides

  turn cw (120) degrees

  sides

  turn cw (120) degrees

  sides

  pen up

  turn cw (120) degrees

  sides

  move (20) steps

  turn cw (60) degrees

end

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×