We want to graph each day and newAmount pair in our calculation. To help accomplish this task, we'll add a broadcast block to the end of the forever if block.
Experiment with setting different values for startAmount and days and observe the graph. Depending on the values you use, your graph may look a little different than my screenshot.
You did look at the values reported in the newAmount monitor block, didn't you? If I gave you three pesos and doubled it every day for the next 15 days, you'd end up with 49,152 pesos. Wow.
We used a few tricks to graph each days and newAmount pair. For each day in our calculation, we moved to the right by ten pixels. This number works because we will never calculate more than 30 days, which means, we need 300 pixels on the X axis to draw our biggest graph.
The Y axis presented a problem because of the larger numbers assigned to the newAmount variable. That's why we calculated our y value by taking the natural log of newAmount.
If you calculated a value using 30 days and a startAmount of 5, then you realized there wasn't enough room on the stage for the last two days on our graph. For this game, we were willing to live with that.
Finally, we stamped each point on the graph so that when the double sprite moved to the next coordinate, we plotted a visible curve.
Scratch provides several built-in trigonometry functions to help us perform mathematical calculations:
The stamp block in the Pen palette creates an impression of the sprite that remains even after the sprite changes. It can be useful to create a history of the sprite's appearance or location. Or, we can use the stamp block to create a pattern, like we did with our graph.
If you look at the help topic for the stamp block, you'll see a different example.
18.218.19.220