https://github.com/nature-of-code/noc-syllabus-modules/tree/main/module00-intro

Bug Scene

I wanted to create a bug-flying scene and set the following rules:

State

The bug will have three states:

  1. Stay - The bug remains still on the wall.
  2. Crawl - The bug moves slowly in a random direction.
  3. Fly - The bug moves randomly in the air.

Probability Control

  1. State transitions:
  2. ~~Cake attraction:~~
  3. ~~Flyswatter avoidance:~~

Current Code

https://editor.p5js.org/sh7361/sketches/c_oi0tuOC

What I did

Using the code from The Nature of Code, Exercise 0.7, I make the bug movement looks nature in each state by adjusting the step size.

Unsolved questions