We need to add a new sprite and a new broadcast message to coordinate the dots with the line:
If you didn't adjust your pen size and color, feel free to customize those values. A larger pen size creates a thicker line.
When you click on the color square in the set color block, a color palette displays. Set the color by picking a spot with the eye dropper.
Calculate—Graph—Draw. These are the three general tasks in our project to this point.
Each time the double sprite calculated a value for the newAmount variable, it broadcast the graph message, which signaled the double sprite to move to a set of coordinates where it created a dot with the stamp block. After the double sprite created a dot, the grapher-double sprite chased after the double sprite, leaving a line in its wake.
When we clicked the flag, our graph was cleared from the stage. That's because we added the clear block to the double block in one of our earlier exercises.
Our graph almost worked correctly. If you studied the line we just added with the pen tool, you noticed that the line probably didn't start until the third dot or so. If you tested different days and startAmount values, then you might have seen an errant line, as shown in the following screenshot:
Before we fix this problem, see if you can identify why our line doesn't draw like we expect, and see if you can come up with a solution. I'll wait.
3.138.116.50