Using Nested If and loops
- Kevin Cen

- Jan 10, 2021
- 1 min read
For this assignment, I have to use the nested ifs, loops and custom functions to create a landscape or seascape in P5 Editor.
Nested ifs means putting an if statement within another if statement, loops means that I can create different objects or shapes with much less coding, and custom functions are the functions that created by ourselves for custom shapes or objects and make them as modules which can be repeat over and over again with just calling the function.
I used to struggle with the mousePressed function, because it only allows me to click once and happen once, then I figured it out and made the function run every time when i clicked it and it was more interactive than the first draft.
https://editor.p5js.org/Kcenfeng/sketches/gwENW0riR
The landscape at nighttime:

The landscape at daytime:







Comments