Final Project – Pearls

Concept:

My concept is to create a playful pearl diving experience where the user is collecting pearls with their index finger.

Sketch:

Code Logic:

  • Background: I created a gradient animated background to give an underwater sea effect.
  • Flock: I added a school of fish to make the sketch more vibrant and dynamic.
  • Pearls: The pearls are randomly added to any position in the canvas, the contain function is used to check whether the finger has touched it or not so that it can pop it and place another one.

Concepts used from class:

  • Particle systems (flow field)
  • Oscillation
  • Autonomous agents (flocking)

Challenges:

I faced some challenges as I initially wanted the background to just be some waves created by the flow field, but everything else was also fading out along with it so it did not work out as I wanted. Instead, I created the gradient background to show a more underwater sea effect.

// Gradient Background
  for (let i = 0; i < height; i++) {
    let inter = map(i, 0, height, 0, 1);
    let c = lerpColor(color(0, 30, 100), color(0, 155, 255), inter);
    // Add slight bg with the 'sin' function based on time
    c = lerpColor(c, color(0, 0, 100), sin(bg * 0.01 + i * 0.05) * 0.1);
    stroke(c);
    line(0, i, width, i);
  }

  // Create an ocean floor wave pattern that moves over time
  stroke(255, 255, 255, 50);
  beginShape();
  for (let x = 0; x < width; x++) {
    let y = height * 0.75 + sin(TWO_PI * 0.002 * x + bg * 0.05) * 10;
    // vertex(x, y);
  }
  endShape();

  // Increment time for the bg
  bg += 1;

User testing:

Most of the comments I got were regarding the scale of everything. As I was working on a 400×400 canvas, I had not realized everything looked so small. When it was set to fullscreen I had to make some changes to the pearl size and the finger circle. I also made a few more changes when I saw it on the iMac since they still appeared small. Overall, the users really enjoyed playing the game and kept going to make a new high score for themselves.

IM Showcase:

IMG_6642

IMG_6639

References:

Future Improvements:

For future improvements, I would add more sea elements to enhance the visuals and some pearl shells that open and close to make the game more challenging.

Leave a Reply

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