Digital Scene Sketch Example

Here’ some code I whipped up as another example of Top Down Design & Abstraction.

The terms INCREMENTAL and ITERATIVE are tough to explain unless you show them what the code looks like in stages with perhaps the definition and calls of the functions but without the details of the definitions.

This code focuses on SIZE being a parameter so the proportions stay the same in a complex drawing.

Tribute to Spongebob

Disclaimer: This code was not originally intended to be shared with this forum.

1 Like

Love it @jkeays !

I also have been focusing more on functions in the turtle unit. Students can make a TON of functions using just turtle commands, but I feel like they don’t totally get it yet - esepcially when it comes to parameters. This year, I made each student have one function with a parameter that THEY WROTE in their scene - so one per student in each scene. That helped but we are doing extra practice now with functions and parameters following @dschneider 's lead here.

It went really well!

Hi - great samples of student work! I have a question on how to create something. A student is making mountains for a background. How could he code a triangle (I guess) without just using a thicker pen width?
I can’t figure it out. Anyone know?

Thanks

Basically, you are drawing more of the same shape at different sizes.

Run this but slow it down to see how I keep drawing the same equilateral triangle over and over again but each triangle gets smaller and smaller.

I would write this code a different way if I had to make the triangle and size of the triangle more flexible.

filledInTriangle(160,200,200);
function filledInTriangle(x,y,sideLength) {
for (var i = 0; i < 50; i++) {
penUp();
moveTo(x, y);
turnTo(0);
moveForward((sideLength-i3)/Math.sqrt(3));
penDown();
drawOneTriangle(sideLength-i
3);
}
}
function drawOneTriangle(side) {
turnTo(210);
moveForward(side);
turnTo(90);
moveForward(side);
turnTo(330);
moveForward(side);
}

Here’s another that fills in a rectangle

drawFilledInRect(160,240,100,60);
function drawFilledInRect(x,y,length,width) {
penUp();
moveTo(x, y);
penDown();
penColor(“red”);
for (var i = 0; i < width; i++) {
penDown();
move(length, 0);
penUp();
move(-length, 1);
}
}

1 Like

Here’s another full project from one of my student groups that fill in mountains with a different technique.
Remix and Study

1 Like

Thank you so much! That’s great