Object Dancer: Pink Pom

Concept & Description

For this mini project, I created an object dancer using OOP.  When dancing, there are many different motions so I tried to incorporate them into my object dancer to make it more playful. My object dancer has 5 motions, including the movement of its eyes, mouth, arms, legs and body as a whole. The eyes move back and forth, making it seem like my dancer is looking around. The mouth moves up and down, which can make it look like the dancer is either talking or singing. The arms and legs go up and down, which is the main movement of the dancer. Since the legs are going up and down, it would not be complete if it didn’t bounce, so I added a bounce to make it look like the dancer is jumping up and down. Additionally, I added a hat to give it more character.

GitHib Link

Coding

Since I had difficulty coming up with what I wanted my dancer to look like, I kept it simple and focused on the movements. For the constructors, I added this.bounceSpeed to control the speed on my dancers bounce, this.bounceRange to control the range the dancer bounced in, this.mouthY for the vertical position of the mouth, and this.mouthDirection to control the direction of the mouth.

For the update function, I had to update all of the movements, including the movement of the eyes, legs, arms, mouth and position of the dancer. For the majority of them, I used sin and frameCount to have the movement oscillate back and forth. For the mouth, I made sure that this.mouthDirection would switch directions once this.mouseY was either more than 13 or less than 5.

Reflection

The benefit of my class not relying on any code outside of its own definition is that it becomes a standalone entity that can be used in various parts of my program or even in other programs without causing conflicts or dependencies on external code For example,  when the professor combines everyone’s dancers into the same program, there are no conflicts or issues due to dependencies on external code.

The challenge in writing code that harmonizes with others’ code lies in the diverse coding styles, potentially leading to variables sharing names but serving different purposes. This discrepancy can cause conflicts when integrating code, posing compatibility issues.

Modularity in the dancer class means breaking code into smaller parts for easier management, such as my update and display functions. The update function manages the behaviors and movements, while the display function manages the appearance of my dancer. Reusability refers to using the same code for different dancers with minimal changes. For example, I can create multiple instances of EllenDancer class, each with different bounce speeds, bounce ranges, and more. These instances represent different dancers with distinct characteristics, all using the same code structure defined in my dancer class.

Leave a Reply

Your email address will not be published. Required fields are marked *