At the end of this lesson students will be able to:
Who has used a paint program to draw on a screen?
Does anyone think they know what is going on behind the scenes to make that happen?
There is some pretty cool but simple programming going on to make these lines appear on the screen. It’s really a two-step process. One to make an actor follow a mouse pointer and another one to trace a line on the screen that follows the path of the mouse pointer.
In this lesson we’re going to learn how to program actors to draw colored lines on the screen using the point towards, pen down and set pen color coding blocks. Are there any questions?
Let me show you the coding blocks we’re going to be using in this lesson.
The blocks we will be learning about in this lesson are ‘when false occurs’, ‘mouse down?’, ‘repeat while false’, ‘point towards mouse pointer’, ‘move 10 steps’, ‘wait 1 second’, ‘repeat while’, and ‘set pen color to’.
Now it’s time to get started.
We need to do one last thing before you get to try on your own. In this puzzle we need to get the racer to trace a green line as it follows the mouse pointer.
Yes. We need to use the ‘when mouse down occurs’ blocks along with a repeat loop that causes the car to continually move in the direction of the mouse. Are there any questions?
Now, how can we make the racer trace a green line as it moves?
Yes. We need to set the pen color to green and put the pen down ready to draw when the program starts. To do this we need to use the ‘set pen color to’ and the ‘pen down’ blocks. Are there any questions?
Read the instructions and watch the completed sample then click the orange button at the bottom of each instruction page to move to the next step.
When you have successfully successfully made your own drawing save your project and take the quiz. If you had any problems with the quiz go back and review the module you had difficulty with.
In this lesson we learned how to make an actor point towards and follow a mouse pointer. We also learned how to trace a colored line on the screen by using the ‘pen down’ and ‘set pen color to’ code blocks.
How can you practice the skills you learned in this lesson? Maybe you can research how spiders spin their webs and then create your own program to help a spider spin a web by following the direction of the mouse. Think about the background and other elements you need to make your scene accurate and interesting.
Did you enjoy learning how to draw with the mouse? Keep practicing the skills you learned in this lesson and explore your creative side by drawing with the pen. What colors can you use? Can you add more than one pen?
Now, let’s get ready for the next lesson called Following the Mouse where we will learn how to program actors to follow the location of the mouse.
By the end of the year, read and comprehend informational texts, including history/social studies, science, and technical texts, at the high end of the grades 4 and 5 text complexity band independently and proficiently.
Explain the relationships or interactions between two or more individuals, events, ideas, or concepts in a historical, scientific, or technical text based on specific information in the text.
Use a pair of perpendicular number lines, called axes, to define a coordinate system, with the intersection of the lines (the origin) arranged to coincide with the 0 on each line and a given point in the plane located by using an ordered pair of numbers, called its coordinates. Understand that the first number indicates how far to travel from the origin in the direction of one axis, and the second number indicates how far to travel in the direction of the second axis, with the convention that the names of the two axes and the coordinates correspond (e.g., x-axis and x-coordinate, y-axis and y-coordinate).
Represent real world and mathematical problems by graphing points in the first quadrant of the coordinate plane, and interpret coordinate values of points in the context of the situation.
Follow precisely a multistep procedure when carrying out experiments, taking measurements, or performing technical tasks.
Determine the meaning of symbols, key terms, and other domain-specific words and phrases as they are used in a specific scientific or technical context relevant to grades 6 - 8 texts and topics.
Integrate quantitative or technical information expressed in words in a text with a version of that information expressed visually (e.g., in a flowchart, diagram, model, graph, or table).