I want you to examine the next two examples to figure out how I am doing what I am doing.
The following example has “bouncing happy faces”. But, when two of the run into each other, one is deleted. When a happy face is deleted, two more are re-generated. This occurs until an upper-threshold of the number of happy faces is reached.
[ Code Download ] | [ View on GitHub ] | [ Live Example ] |
In the next example, the sketch creates 100 “PacMan-like” objects. These move only along cardinal directions (north, south, east, or west). After some random amount of time, each object can randomly choose another of those four directions to travel.
If, a PacMan runs into another PacMan that is blocking his path, then he waits until he chooses a new direction, or the blocking PacMan moves out of the way.
[ Code Download ] | [ View on GitHub ] | [ Live Example ] |