top of page

Using Nested If and loops

  • Writer: Kevin Cen
    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:

ree

The landscape at daytime:

ree

Comments


Join our mailing list

Thanks for submitting!

  • Black Facebook Icon
  • Black Twitter Icon
  • Black Pinterest Icon
  • Black Flickr Icon
  • Black Instagram Icon

© 2023 by The Mountain Man. Proudly created with Wix.com

bottom of page