For my particle world project I made a bunch of worms with vision float around hungry in the blue sky.
FoIn this project, I began by focusing on my concept, in this case, worms. Using the Worm class, I structured each worm with properties such as position, a trail of past movements, and visual elements like body color and eye details. I began the sketch with three worms placed randomly on the canvas and used noise to influence their movement.I also ensured each worm left a bit of a trail behind for that “slither.io” aesthetic, To keep the sketch more nuanced, I added a new worm every 22 frames, to create a more engaging screen. I also added the eyes for the worms so that they look at you the entire time. Additionally, I incorporated the concept of lifespan, giving each worm a finite duration in the sky on the canvas. The lifespan would decrease frame by frame, and once it reached zero, the worm would then be removed from the system. This added a natural cycle of life and death onto the skdtch.
What is Object-Oriented Programming (OOP), a Class, and an Instance of the Class?
OOP is simply a way of coding that organizes things in objects that represent things usually of the real world. A class kinda defines what an object is and how it behaves. An instance of the class is an actual object created from that, like a worm in my project.
Discuss the effectiveness of OOP. When is OOP useful? How can it be utilized?
OOP is effective because it keeps code organized, reusable, and easier to understand, especially in large projects like this collaborative one. It’s useful when you have many objects that need some sorta different structure but also to behave independently. It can be utilized for creating an interactive game, or websites that involve lots of repetitive interacting elements.
Describe the objects you have created. What properties and methods were implemented? What behaviors did you create by manipulating them?
I created worms as objects. Each worm had properties like position, trail, color, and lifespan. Methods were added for movement like (update()), drawing the worm (display()), and checking if it was still very much alive (alive). By manipulating these properties, I made worms move randomly, leave trails, and disappear after their lifespan ended only to descend to the worm afterlife.
Share any challenging and confusing aspect(s) in the OOP concepts and techniques.
The most challenging part was understanding how to manage the interactions between objects and keeping track of their lifecycle. Getting rid of the "dead" objects/worms and updating the behavior of multiple objects simultaneously was frustrating but eventually I got there.