Fun with ColorWe can also add some interesting visual effects with color using the patches in the Kedama world. First, go ahead and pause your script while we make these changes. From the turtle’s viewer, drag out the “patchValueIn” tile and drop it in your script. |
|||||||||||||||||||||
![]() |
|||||||||||||||||||||
| This tile allows you to assign a numerical value to each patch. The numbers you choose also influence the colors of the patches, as higher numbers increase the brightness of a patch’s color. For example, changing the argument value of the tile to 10 would put a faint color in the patch where the turtle currently resides. For now, change the argument value of the tile to 40. Then, press the little upward triangle at the left of "patchValueIn" to change it "patchValueIn patch increase by." | |||||||||||||||||||||
![]() |
|||||||||||||||||||||
Go ahead and run your script. Notice that the color in the smaller rectangle turns blue as the turtles leave behind a trail of colored dots. If you want your turtles to leave trails of a different color, you can change it using the patch viewer. To see the viewer for the patches, open the Kedama viewer and select the icon next to the “Kedama’s patch” variable. |
|||||||||||||||||||||
| Choose “grab morph,” and a small box that looks like a mini-Kedama world will appear. This is a representation of a patch in the Kedama world. Place this on your screen besides the Kedama world. Now, click on the patch morph and open its viewer. You should see the “kedama” category menu already open. Then, click on the colored box in the “patch’s color” tile and select the color you want. | |||||||||||||||||||||
![]() |
|||||||||||||||||||||
Pause your script again for a few more changes. The effects here will be easier to see if there are fewer turtles, so change the turtleCount to "20.” Then, set your turtles to move forward by 2. Next, find the “scaleMax” tile in the patch viewer and set its value to “200.” |
|||||||||||||||||||||
![]() |
|||||||||||||||||||||
By doing this, you set 200 as the upper limit of color saturation for the patch. If you want, you can change this value and observe what happens to the colors against the black Kedama background. Finally, drag out the "patch diffusePatchVariable" and drop it onto the scriptor. This will add the visual effect of the turtles’ trails diffusing, or spreading out, behind them. You’re almost ready to go! To prepare the Kedama world for your new script, press the yellow exclamation mark at the left of "patch clear" to erase the blue dot trails from the patches in the Kedama world. |
|||||||||||||||||||||
![]() |
|||||||||||||||||||||
Run your script! You'll see the turtles leaving "fume" as
they move forward. One more thing: remember the thumbnail labeled “KedamaWorldBundle”? If you were to drag that icon onto the etoy world, what you would see would be these three components already bundled together, ready for you to use: a Kedama world, a patch morph, and a turtle breed. Now that you can create different breeds of turtles and make them move, you’re ready to write your own script to simulate the spread of an epidemic. |
|||||||||||||||||||||