Final Project

After all the mental breakdowns and the literal physical pain, this semester has come to a close. My final project wanted to raise some sort of awareness on the environment and on the dangers of consumption and greed. Although it did come out a bit more comical than I intended it to,  I think my final project was a success as it made people laugh, have fun and more importantly, think.

These are all the paintings for the interface, done with watercolors:

The box went from this:

To this:

I still think it would’ve looked nicer with wood, but for something DIY-ed I think it looks really good.

This is the code for my final project, never thought I’d say this in my life but I’m glad the code got deleted because I actually learned a lot while working and figuring things out. The funniest thing was attempting to add the sounds to the program last minute, and it actually worked!!!!

import processing.sound.*;
SoundFile beep;
SoundFile happy;
SoundFile scary;

import processing.video.*;
import jp.nyatla.nyar4psg.*;


PImage background;
PImage background2;
PImage tree;
PImage tree2;
PImage bush;
PImage mushroom;
PImage factory;
PImage waterBottle;
PImage TrashCan;
PImage bags;
PImage bear;
PImage dBear;
PImage lily;
PImage lily2;
PImage fish1;
PImage fish2;
PImage fish3;
PImage deadFish1;
PImage deadFish2;
PImage deadFish3;
PImage bird;
PImage bird2;
PImage bird3;
PImage bird4;
PImage deadBirdPic; 
PImage deadBirdPic2;


Movie Apocalypse;


int value = 0;


Capture cam;


MultiMarker nya;


int[] objects = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int i = objects.length;


boolean b = true;
boolean backgroundB = false;
boolean factoryPic = false;
boolean trashCan = false;
boolean bag = false;
boolean bottle =false;
boolean apocalypse = false;
boolean deadBird = true; 
boolean treesGone = true; 
boolean deadBear = true;
boolean fish = true; 
boolean Badmusic = false;

void setup() {
  //size(1920, 1080, P3D);
  fullScreen(P3D, 2);
  colorMode(RGB, 100);
    String[] cameras = Capture.list();
  //printArray(cameras);
  cam = new Capture(this, cameras[0]); 
  //cam=new Capture(this, 1280,700);
  nya=new MultiMarker(this, 1920, 1080, "camera_para.dat", NyAR4PsgConfig.CONFIG_PSG);
  
  Apocalypse = new Movie(this, "fire.mov");
  
    beep = new SoundFile(this, "beep.wav");
    scary = new SoundFile(this, "thunder.wav");
    happy = new SoundFile(this, "nature.wav"); 
    
  background = loadImage("background.png");
  background2 = loadImage("background2.png");
  
  factory = loadImage("factory4.png");
  TrashCan = loadImage("trashcan.png");
  bags = loadImage("bags.png");
  waterBottle = loadImage("waterBottle.png");
  

  tree = loadImage("tree.png");
  bush = loadImage("bush.png");
  tree2 = loadImage("tree2.png");
  bear = loadImage("bear.png");
  dBear = loadImage("deadBear.png");
  
  bird = loadImage("bird.png");
  bird2 = loadImage("bird2.png");
  bird3 = loadImage("bird3.png");
  bird4 =loadImage ("bird4.png");
  deadBirdPic = loadImage("deadBird.png");
  deadBirdPic2 = loadImage("deadBird2.png");
  
  fish1 = loadImage("fish1.png");
  fish2 = loadImage("fish2.png");
  fish3 = loadImage("fish3.png");
  deadFish1 = loadImage("deadfish1.png");
  deadFish2 = loadImage("deadfish2.png");
  deadFish3 = loadImage("deadfish3.png");
  lily = loadImage("lily1.png");
  lily2 = loadImage("lily2.png");
  
  
  fish1.resize(80,100);
  fish2.resize(80,100);
  fish3.resize(100,80);
  deadFish1.resize(120,80);
  deadFish2.resize(120,80);
  deadFish3.resize(120,80);
  
  tree.resize(600, 750);
  tree2.resize(500,600);
  bush.resize(200,400);
  
  bear.resize(280, 400);
  dBear.resize(450,180);
  
  bird.resize(200, 200);
  bird2.resize(200, 200);
  bird3.resize(200,100);
  bird4.resize(200,200);
  deadBirdPic.resize(200,100);
  deadBirdPic2.resize(300,100);
  factory.resize(350, 550);
  TrashCan.resize(400,600);
  bags.resize(500,400);
  //dBear.resize(,)
  factory.resize(400, 600);
  for (int c = 0; c < i; c++) {
    nya.addNyIdMarker(c, 80);
  }

  cam.start();
  background(background);
  noCursor();
}

void draw() {
  if (cam.available()!=true) {
    return;
  }
  cam.read();
  nya.detect(cam);
  background(background);

  image(Apocalypse, 0, 0);

  //if (b) {
  //  pushStyle();
  //  imageMode(CORNER);
  //  pushMatrix();
  //  //translate(1280/2,700/2);
  //  nya.drawBackground(cam);
  //  popMatrix();
  //  popStyle();
  //}

  //Apocalypse.resize(displayWidth,displayHeight); how do i make the video fullscreen?
  //use some app and rezise and change the Apocalypse video before class on Monday please please please Dhabiaaaa
  
  for (int c = 0; c < i; c++) {
    if ((!nya.isExist(c))) {
      //println(nya.getNyId(c));
      
      //println("returning");
      continue;
    }

    if (c==1) {
      if (!beep.isPlaying() && deadBear==true){
        beep.play();
      }
      else{
        beep.stop();
      }
      //Bear turns to carpet code 
      deadBear = false;
      break;
    }
    
    if (c==2 && treesGone == true) {
       treesGone = false;
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }   //tree falls code because of table or chair or maybe both????
    }
    
    if (c==3 && trashCan == false) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }
      trashCan = true;
     }
          
    if (c==4&& factoryPic==false) {
      factoryPic = true;
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }
    }

    if (c==5 && fish == true) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }      //fish
      fish = false;
    }
    
    if (c==6 && deadBird == true) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }      //bird dies 
      deadBird = false;
    }
    
    if (c==7 && bag == false) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }      bag = true;
    }
    
    
    if (c==8 && backgroundB ==false) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }      backgroundB = true;
    }
    
    if (c==9) {
      
    }
    
    if (c==0 && apocalypse == false) {
      if (!beep.isPlaying()){
        beep.play();
      }
      else{
        beep.stop();
      }      //don't forget to rezie the video + add a text that says, real life has no reset button
      Apocalypse.loop();
      apocalypse=true;
    }
    

  }


  
  if (backgroundB){
    background(background2);
    
  }
  
  if (bag && apocalypse == false){
    image(bags, 1100, 250); //fix
  }
  

  
  if (!deadBird && apocalypse==false){
    image(deadBirdPic, 80,780);
    image(deadBirdPic2, 600, 450);
  }
  if (deadBird && apocalypse==false){
  image(bird, 800, 100);
  image(bird2, 100, 50);
  image(bird3, 1000, 50);
  image(bird4, 500, 50);
  }
  if (fish && apocalypse == false){
    image(fish1,700,750);
    image(fish2,500,740);
    image(fish3,900,730);
    image(lily,1000,740);
    image(lily2,800,720);

  }
  if (!fish && apocalypse == false){
    image(deadFish1,700,750);
    image(deadFish2,1100,730);
    image(deadFish3,900,730);
  }
  if (treesGone && apocalypse == false){
  image(tree2,1000,100);    
  image(tree, 1300, 0);
  image(bush,1300,500);
  //Add more trees
  }
  if (deadBear && apocalypse == false){
   image(bear, 250, 600);  
  }

  
  if (trashCan && apocalypse == false){
    image(TrashCan, 1400, 550); //fix

  } 
  
    if (factoryPic) {
    image(factory, 0, 0);
  }
  
    if (!deadBear && apocalypse == false){
    image(dBear,100,500);
  }
  
  if (!apocalypse){
    if (!happy.isPlaying()){
      happy.loop();
    }
  }
  
  if (apocalypse) {
    if (happy.isPlaying()){
      scary.loop();
    if (scary.isPlaying()){
      happy.stop();
    }
      
    }
    image(Apocalypse, 0, 0);
    textSize(80);
    text("Real life has no reset button", 50, 80);
    factoryPic = false;
    treesGone = false; 
    deadBird=true; 

  }
}


void keyPressed() {
  if (keyPressed) {
    if (key == 'b' || key == 'B') {
      b = !b;
    }
  }
}


void movieEvent(Movie m) {
  m.read();
}

 

Leave a Reply