Code Sketch


Episode 4: Rainbow shading to our patterns too! Drawing house with triangle and square
By: Clinton J. Fernandes
Category: Programming
//CLINTON CODE
//Drawing a square
clear()
setPosition(-300,-100)
setFillColor(Color(255, 37, 18))
setPenColor(black)
forward(100)
right()
forward(100)
right()
forward(100)
right()
forward(100)
right()

//Drawing a Triangle
hop(100) 
setFillColor(Color(51, 51, 255))
setPenColor(black)
right(30)
forward(100)
right(120)
forward(100)
right(120)
forward(100)



//Drawing a Pattern 1
setPosition(0,0)
setSpeed(medium)
repeat(10) {
    setFillColor(randomColor)           
    repeat(4) {
        forward(100) 
        right()
    }
    right(36)
}

//Drawing a Pattern 2
setPosition(320,0)
setSpeed(medium)
repeat(10) {
    setFillColor(randomColor.fadeOut(0.5))    
    repeat(4) {
        forward(100)
        right(90)
    }
    right(36)
}