Project 10

Under the sea! My 5 characters are the ocean, jellyfish, fish, big whale, and small whale.

sketch
// Sowang Kundeling Project 10 Section C

var count = 0;
x = 50
var count = 0

function preload() {
  ocean = loadSound("http://localhost:8887/ocean.wav");
  low = loadSound("http://localhost:8887/low.wav");
  bubble = loadSound("http://localhost:8887/bubble.wav");
  high = loadSound("http://localhost:8887/high.wav");
  splash = loadSound("http://localhost:8887/splash.wav");

  sea = loadImage("https://i.imgur.com/cDVwxGl.jpg");
  big = loadImage("https://i.imgur.com/3j8OG8S.png");
  little = loadImage("https://i.imgur.com/eBmN7hL.png");
  jellyfish = loadImage("https://i.imgur.com/LbEcOSU.png");
  fish = loadImage("https://i.imgur.com/FSQzu31.png")
}

function soundSetup() {
  ocean.setVolume(.1);
  low.setVolume(.3);
  bubble.setVolume(.1);
  high.setVolume(.3);
  splash.setVolume(.1);
}

function setup() {
  createCanvas(sea.width, sea.height);
  frameRate(1);
  useSound();
}

function draw() {
  image(sea, 0, 0, sea.width, sea.height);
  ocean.play();

  if(count == 2 || count == 16) {
    low.play();
  } else if(count == 4 || count == 18) {
    bubble.play();
  } else if (count == 10 || count == 25) {
    high.play();
  } else if (count == 1 || count == 30 || count == 15) {
    splash.play();
  }

  if(count >= 5) {
    image(big, 20, 50, big.width/4, big.height/4);
  } if(count >= 10) {
    image(little, 400, 200, little.width/2, little.height/2);
  } if(count >= 4) {
    image(jellyfish, x, 300, jellyfish.width/4, jellyfish.height/4);
  } if (count >= 15) {
    image(fish, mouseX, mouseY, fish.width/6, fish.height/6);
  }

  count++
  x += 2

  print(count);
}

Leave a Reply