itch.io is community of indie game creators and players

Devlogs

Create a Class and Vectors

Hello! This is my third Devlog of the semester.

I jumped right into the class practice. I felt in control of this due to our class meeting and the previous semester. I used the code from class, which was a good starting point. I was trying to draw the image myself inside p5.js, but getting the dots to be placed correctly on the bug was difficult. Now that I am thinking about it, I could have tried without using the random feature in placement but made it all predetermined. 

I ended up going into my drawing program and drew up a quick ladybug, which, in the end, did look better. I made a few color variations, and then made an if statement to read a random roll to determine which image to show. This wasn't working, so I had to analyze the code. I had two problems. First, I had nestled the second statement inside the first, so It would never be true (b/c choice can/t === 1 and 2 at the same time). Also, I was calling random(1,2), attempting to receive two possible outputs, but you must make the highest value one above what you intend, so I changed it to(1,3).

Those fixes allowed my ladybugs to generate different colors. I lastly made a variable to run a random command for the size. I decided to keep the change direction feature. Then, I drew up a quick background for my ladybugs. 

Overall this was easy and actually fun for me! I feel I am a lot stronger using images or drawings rather than using p5. js' drawing features. I would like to explore this difference in the future. 

Here is the code: https://editor.p5js.org/gracelynn/sketches/Q0fCvVyY_

Leave a comment