import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer bark;
AudioPlayer heyya;
AudioPlayer radio;
AudioPlayer tv;
AudioPlayer vac;
AudioPlayer pot;
AudioPlayer salsa;
AudioPlayer trumpet;
AudioPlayer alarm;
PImage brownstone;
PImage brick;
PImage [] TVimages = new PImage [4];
PImage [] DINNERimages = new PImage [5];
PImage [] RADIOimages = new PImage [4];
PImage [] DANCEimages = new PImage [3];
PImage [] VACimages = new PImage [3];
PImage [] TRUMPETimages = new PImage [3];
PImage [] TOPargueimages = new PImage [2];
PImage [] DOGimages = new PImage [4];
PImage [] KITCHENimages = new PImage [3];
PImage [] BOTTOMargueimages = new PImage [2];
PImage kitchenTile;
int TVframe = 0;
int TVcounter = 4;
int DINNERframe = 0;
int DINNERcounter = 5;
int RADIOcounter = 4;
int RADIOframe = 0;
int DANCEcounter = 3;
int DANCEframe = 0;
int VACcounter = 3;
int VACframe = 0;
int TRUMPETcounter = 3;
int TRUMPETframe = 0;
int TOPargueframe = 0;
int TOParguecounter = 2;
int DOGframe = 0;
int DOGcounter = 4;
int KITCHENframe = 0;
int KITCHENcounter = 3;
int BOTTOMargueframe = 0;
int BOTTOMarguecounter = 2;
//boolean argueMan = false;
int fiveSeconds = 5000;
int threeSeconds = 3000;
int twoSeconds = 2000;
int timeNow2;
int timeNow3;
int timeNow9;
int timeNow10;
boolean action2 = false;
boolean action3 = false;
boolean action9 = false;
boolean action10 = false;
Button[] buttons = new Button[6];
void setup() {
minim = new Minim(this);
heyya = minim.loadFile("heyya.mp3");
heyya.loop();
heyya.mute();
bark = minim.loadFile("Bark.mp3");
bark.loop();
bark.mute();
tv = minim.loadFile("tv.mp3");
tv.loop();
tv.mute();
vac = minim.loadFile("vac.mp3");
vac.loop();
vac.mute();
pot = minim.loadFile("pot.mp3");
pot.loop();
pot.mute();
salsa = minim.loadFile("salsa.mp3");
salsa.loop();
salsa.mute();
trumpet = minim.loadFile("trumpet.mp3");
trumpet.loop();
trumpet.mute();
radio = minim.loadFile("radio.mp3");
radio.loop();
radio.mute();
alarm = minim.loadFile("alarm.mp3");
alarm.loop();
alarm.mute();
size(900, 600);
brownstone = loadImage("building2.png");
frameRate(5);
for (int i=0; i<TVimages.length; i++) { //Load TV images
TVimages[i] = loadImage("tv" + i + ".png");
}
for (int i=0; i<RADIOimages.length; i++) { //Load Dinner images
RADIOimages[i] = loadImage("radio" + i + ".png");
}
for (int i=0; i<DANCEimages.length; i++) { //Load Dance images
DANCEimages[i] = loadImage("dance" + i + ".jpg");
}
for (int i=0; i<VACimages.length; i++) { //Load Vacuum images
VACimages[i] = loadImage("vac" + i + ".png");
}
for (int i=0; i<TRUMPETimages.length; i++) { //Load Trumpet images
TRUMPETimages[i] = loadImage("trumpet" + i + ".png");
}
for (int i=0; i<DOGimages.length; i++) { //Load Dog images
DOGimages[i] = loadImage("dog" + i + ".png");
}
for (int i=0; i<KITCHENimages.length; i++) { //Load Kitchen images
KITCHENimages[i] = loadImage("kitchen" + i + ".png");
}
brick = loadImage("brick.png");
kitchenTile = loadImage("kitchenTILE.png");
for (int i=0; i<TOPargueimages.length; i++) { //Load TOP argue images
TOPargueimages[i] = loadImage("TOPargue" + i + ".png");
}
for (int i=0; i<BOTTOMargueimages.length; i++) { //Load BOTTOM argue images
BOTTOMargueimages[i] = loadImage("BOTTOMargue" + i + ".png");
}
smooth();
for (int i = 0; i < buttons.length; i++) {
buttons[i] = new Button(65, 215, 350, 490, 625, 765, 85, 300, 95, 140, 200);
}
}
void draw() {
background(0, 0, 150);
pushMatrix();
scale(0.5);
image(TVimages[TVframe], 55, 170); //Display TV animation
TVframe = (TVframe+1) % TVcounter;
popMatrix();
pushMatrix();
scale(.2);
rotate(.2);
image(TRUMPETimages[TRUMPETframe], 1700, 0); //Display trumpet animation
TRUMPETframe = (TRUMPETframe+1) % TRUMPETcounter;
popMatrix();
pushMatrix();
scale(0.8);
image(DOGimages[DOGframe], 200, 105); //Display Dog animation
DOGframe = (DOGframe+1) % DOGcounter;
popMatrix();
pushMatrix();
scale(.8);
image(RADIOimages[RADIOframe], 240, 380); //Display Radio animation
RADIOframe = (RADIOframe+1) % RADIOcounter;
popMatrix();
pushMatrix();
scale(.4);
image(DANCEimages[DANCEframe], 1500, 160); //Display Dance animation
DANCEframe = (DANCEframe+1) % DANCEcounter;
popMatrix();
image(brick, 490, 80, 100, 150);
pushMatrix();
scale(.3);
image(VACimages[VACframe], 2100, 955); //Display vacuum animation
VACframe = (VACframe+1) % VACcounter;
popMatrix();
image(kitchenTile, 750, 300);
pushMatrix();
scale(.3);
image(KITCHENimages[KITCHENframe], 2420, 1295); //Display Kitchen animation
KITCHENframe = (KITCHENframe+1) % KITCHENcounter;
popMatrix();
pushMatrix();
scale(1.1);
image(TOPargueimages[TOPargueframe], 450, 100); //Display top arguement animation
TOPargueframe = (TOPargueframe+1) % TOParguecounter;
popMatrix();
image(BOTTOMargueimages[BOTTOMargueframe], 300, 260); //Display top arguement animation
BOTTOMargueframe = (BOTTOMargueframe+1) % BOTTOMarguecounter;
// Show all the buttons
for (int i = 0; i < buttons.length; i++) {
buttons[i].display();
}
image(brownstone, 0, 0);
}
void mousePressed() {
// When the mouse is pressed, we must check every single button
for (int i = 0; i < buttons.length; i++) {
buttons[i].click(mouseX, mouseY);
}
}
// Button class
class Button {
// Button location and size
float x1, x2, x3, x4, x5, x6;
float y1, y2;
float w;
float h, h2;
// Is the button on or off?
boolean on1, on2, on3, on4, on5, on6, on7, on8, on9, on10;
// Constructor initializes all variables
Button(float tempX, float tempX2, float tempX3, float tempX4, float tempX5, float tempX6, float tempY1, float tempY2, float tempW, float tempH, float tempH2) {
x1 = tempX;
x2 = tempX2;
x3 = tempX3;
x4 = tempX4;
x5 = tempX5;
x6 = tempX6;
y1 = tempY1;
y2 = tempY2;
w = tempW;
h = tempH;
h2 = tempH2;
on1 = false; // Button always starts as off
on2 = false; // Button always starts as off
on3 = false; // Button always starts as off
on4 = false; // Button always starts as off
on5 = false; // Button always starts as off
on6 = false; // Button always starts as off
on7 = false; // Button always starts as off
on8 = false; // Button always starts as off
on9 = false; // Button always starts as off
on10 = false; // Button always starts as off
}
void click(int mx, int my) {
// Check to see if a point is inside the rectangle
if (mx > x1 && mx < x1 + w && my > y1 && my < y1 + h) {
on1 = !on1;
}
if (mx > x2 && mx < x2 + w && my > y1 && my < y1 + h) {
on2 = !on2;
}
if (mx > x3 && mx < x3 + w && my > y1 && my < y1 + h) {
on3 = !on3;
}
if (mx > x4 && mx < x4 + w && my > y1 && my < y1 + h) {
on4 = !on4;
}
if (mx > x5 && mx < x5 + w && my > y1 && my < y1 + h) {
on5 = !on5;
}
if (mx > x6 && mx < x6 + w && my > y1 && my < y1 + h) {
on6 = !on6;
}
if (mx > x2 && mx < x2 + w && my > y2 && my < y2 + h2) {
on7 = !on7;
}
if (mx > x3 && mx < x3 + w && my > y2 && my < y2 + h2) {
on8 = !on8;
}
if (mx > x5 && mx < x5 + w && my > y2 && my < y2 + h2) {
on9 = !on9;
}
if (mx > x6 && mx < x6 + w && my > y2 && my < y2 + h2) {
on10 = !on10;
}
}
// Draw the buttons/window shades
void display() {
rectMode(CORNER);
stroke(0);
if (on1) {
noFill();
tv.unmute();
}
else {
fill(0);
tv.mute();
}
rect(x1, y1, w, h); //top row window 1
if (on2) {
noFill();
bark.unmute();
// action2 = true;
}
else {
fill(0);
bark.mute();
}
rect(x2, y1, w, h);
// if (!action3 && millis()>timeNow3 + 2000) {
// on2 = !on2;
// action2 = false;
// }
if (on3) {
noFill();
on2 = true;
action3 = true;
trumpet.unmute();
// timeNow2 = millis();
}
else {
fill(0);
timeNow3= millis();
action3 = false;
trumpet.mute();
}
rect(x3, y1, w, h);
if (action3 && millis()>timeNow3 + threeSeconds) {
on3 = !on3;
}
if (on4) {
noFill();
on8 = true;
alarm.unmute();
}
else {
fill(0);
alarm.mute();
}
rect(x4, y1, w, h);
if (on5 || on6) {
noFill();
heyya.unmute();
}
else {
fill(0);
heyya.mute();
}
rect(x5, y1, w, h);
rect(x6, y1, w, h);
if (on7) {
noFill();
salsa.unmute();
}
else {
fill(0);
salsa.mute();
}
rect(x2, y2, w, h2); //bottom row window 7
if (on8) {
noFill();
alarm.unmute();
}
else {
fill(0);
alarm.mute();
}
rect(x3, y2, w, h2);
if (on9) {
noFill();
action9 = true;
vac.unmute();
}
else {
fill(0);
timeNow9= millis();
vac.mute();
}
rect(x5, y2, w, h2);
if (action9 && millis()>timeNow9 + fiveSeconds) {
on9 = !on9;
}
if (on10) {
noFill();
action10 = true;
pot.unmute();
}
else {
fill(0);
timeNow10= millis();
pot.mute();
}
rect(x6, y2, w, h2);
if (action10 && millis()>timeNow10 + threeSeconds) {
on10 = !on10;
}
}
}
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer bark;
AudioPlayer heyya;
AudioPlayer radio;
AudioPlayer tv;
AudioPlayer vac;
AudioPlayer pot;
AudioPlayer salsa;
AudioPlayer trumpet;
AudioPlayer alarm;
PImage brownstone;
PImage brick;
PImage [] TVimages = new PImage [4];
PImage [] DINNERimages = new PImage [5];
PImage [] RADIOimages = new PImage [4];
PImage [] DANCEimages = new PImage [3];
PImage [] VACimages = new PImage [3];
PImage [] TRUMPETimages = new PImage [3];
PImage [] TOPargueimages = new PImage [2];
PImage [] DOGimages = new PImage [4];
PImage [] KITCHENimages = new PImage [3];
PImage [] BOTTOMargueimages = new PImage [2];
PImage kitchenTile;
int TVframe = 0;
int TVcounter = 4;
int DINNERframe = 0;
int DINNERcounter = 5;
int RADIOcounter = 4;
int RADIOframe = 0;
int DANCEcounter = 3;
int DANCEframe = 0;
int VACcounter = 3;
int VACframe = 0;
int TRUMPETcounter = 3;
int TRUMPETframe = 0;
int TOPargueframe = 0;
int TOParguecounter = 2;
int DOGframe = 0;
int DOGcounter = 4;
int KITCHENframe = 0;
int KITCHENcounter = 3;
int BOTTOMargueframe = 0;
int BOTTOMarguecounter = 2;
//boolean argueMan = false;
int fiveSeconds = 5000;
int threeSeconds = 3000;
int twoSeconds = 2000;
int timeNow2;
int timeNow3;
int timeNow9;
int timeNow10;
boolean action2 = false;
boolean action3 = false;
boolean action9 = false;
boolean action10 = false;
Button[] buttons = new Button[6];
void setup() {
minim = new Minim(this);
heyya = minim.loadFile("heyya.mp3");
heyya.loop();
heyya.mute();
bark = minim.loadFile("Bark.mp3");
bark.loop();
bark.mute();
tv = minim.loadFile("tv.mp3");
tv.loop();
tv.mute();
vac = minim.loadFile("vac.mp3");
vac.loop();
vac.mute();
pot = minim.loadFile("pot.mp3");
pot.loop();
pot.mute();
salsa = minim.loadFile("salsa.mp3");
salsa.loop();
salsa.mute();
trumpet = minim.loadFile("trumpet.mp3");
trumpet.loop();
trumpet.mute();
radio = minim.loadFile("radio.mp3");
radio.loop();
radio.mute();
alarm = minim.loadFile("alarm.mp3");
alarm.loop();
alarm.mute();
size(900, 600);
brownstone = loadImage("building2.png");
frameRate(5);
for (int i=0; i<TVimages.length; i++) { //Load TV images
TVimages[i] = loadImage("tv" + i + ".png");
}
for (int i=0; i<RADIOimages.length; i++) { //Load Dinner images
RADIOimages[i] = loadImage("radio" + i + ".png");
}
for (int i=0; i<DANCEimages.length; i++) { //Load Dance images
DANCEimages[i] = loadImage("dance" + i + ".jpg");
}
for (int i=0; i<VACimages.length; i++) { //Load Vacuum images
VACimages[i] = loadImage("vac" + i + ".png");
}
for (int i=0; i<TRUMPETimages.length; i++) { //Load Trumpet images
TRUMPETimages[i] = loadImage("trumpet" + i + ".png");
}
for (int i=0; i<DOGimages.length; i++) { //Load Dog images
DOGimages[i] = loadImage("dog" + i + ".png");
}
for (int i=0; i<KITCHENimages.length; i++) { //Load Kitchen images
KITCHENimages[i] = loadImage("kitchen" + i + ".png");
}
brick = loadImage("brick.png");
kitchenTile = loadImage("kitchenTILE.png");
for (int i=0; i<TOPargueimages.length; i++) { //Load TOP argue images
TOPargueimages[i] = loadImage("TOPargue" + i + ".png");
}
for (int i=0; i<BOTTOMargueimages.length; i++) { //Load BOTTOM argue images
BOTTOMargueimages[i] = loadImage("BOTTOMargue" + i + ".png");
}
smooth();
for (int i = 0; i < buttons.length; i++) {
buttons[i] = new Button(65, 215, 350, 490, 625, 765, 85, 300, 95, 140, 200);
}
}
void draw() {
background(0, 0, 150);
pushMatrix();
scale(0.5);
image(TVimages[TVframe], 55, 170); //Display TV animation
TVframe = (TVframe+1) % TVcounter;
popMatrix();
pushMatrix();
scale(.2);
rotate(.2);
image(TRUMPETimages[TRUMPETframe], 1700, 0); //Display trumpet animation
TRUMPETframe = (TRUMPETframe+1) % TRUMPETcounter;
popMatrix();
pushMatrix();
scale(0.8);
image(DOGimages[DOGframe], 200, 105); //Display Dog animation
DOGframe = (DOGframe+1) % DOGcounter;
popMatrix();
pushMatrix();
scale(.8);
image(RADIOimages[RADIOframe], 240, 380); //Display Radio animation
RADIOframe = (RADIOframe+1) % RADIOcounter;
popMatrix();
pushMatrix();
scale(.4);
image(DANCEimages[DANCEframe], 1500, 160); //Display Dance animation
DANCEframe = (DANCEframe+1) % DANCEcounter;
popMatrix();
image(brick, 490, 80, 100, 150);
pushMatrix();
scale(.3);
image(VACimages[VACframe], 2100, 955); //Display vacuum animation
VACframe = (VACframe+1) % VACcounter;
popMatrix();
image(kitchenTile, 750, 300);
pushMatrix();
scale(.3);
image(KITCHENimages[KITCHENframe], 2420, 1295); //Display Kitchen animation
KITCHENframe = (KITCHENframe+1) % KITCHENcounter;
popMatrix();
pushMatrix();
scale(1.1);
image(TOPargueimages[TOPargueframe], 450, 100); //Display top arguement animation
TOPargueframe = (TOPargueframe+1) % TOParguecounter;
popMatrix();
image(BOTTOMargueimages[BOTTOMargueframe], 300, 260); //Display top arguement animation
BOTTOMargueframe = (BOTTOMargueframe+1) % BOTTOMarguecounter;
// Show all the buttons
for (int i = 0; i < buttons.length; i++) {
buttons[i].display();
}
image(brownstone, 0, 0);
}
void mousePressed() {
// When the mouse is pressed, we must check every single button
for (int i = 0; i < buttons.length; i++) {
buttons[i].click(mouseX, mouseY);
}
}
// Button class
class Button {
// Button location and size
float x1, x2, x3, x4, x5, x6;
float y1, y2;
float w;
float h, h2;
// Is the button on or off?
boolean on1, on2, on3, on4, on5, on6, on7, on8, on9, on10;
// Constructor initializes all variables
Button(float tempX, float tempX2, float tempX3, float tempX4, float tempX5, float tempX6, float tempY1, float tempY2, float tempW, float tempH, float tempH2) {
x1 = tempX;
x2 = tempX2;
x3 = tempX3;
x4 = tempX4;
x5 = tempX5;
x6 = tempX6;
y1 = tempY1;
y2 = tempY2;
w = tempW;
h = tempH;
h2 = tempH2;
on1 = false; // Button always starts as off
on2 = false; // Button always starts as off
on3 = false; // Button always starts as off
on4 = false; // Button always starts as off
on5 = false; // Button always starts as off
on6 = false; // Button always starts as off
on7 = false; // Button always starts as off
on8 = false; // Button always starts as off
on9 = false; // Button always starts as off
on10 = false; // Button always starts as off
}
void click(int mx, int my) {
// Check to see if a point is inside the rectangle
if (mx > x1 && mx < x1 + w && my > y1 && my < y1 + h) {
on1 = !on1;
}
if (mx > x2 && mx < x2 + w && my > y1 && my < y1 + h) {
on2 = !on2;
}
if (mx > x3 && mx < x3 + w && my > y1 && my < y1 + h) {
on3 = !on3;
}
if (mx > x4 && mx < x4 + w && my > y1 && my < y1 + h) {
on4 = !on4;
}
if (mx > x5 && mx < x5 + w && my > y1 && my < y1 + h) {
on5 = !on5;
}
if (mx > x6 && mx < x6 + w && my > y1 && my < y1 + h) {
on6 = !on6;
}
if (mx > x2 && mx < x2 + w && my > y2 && my < y2 + h2) {
on7 = !on7;
}
if (mx > x3 && mx < x3 + w && my > y2 && my < y2 + h2) {
on8 = !on8;
}
if (mx > x5 && mx < x5 + w && my > y2 && my < y2 + h2) {
on9 = !on9;
}
if (mx > x6 && mx < x6 + w && my > y2 && my < y2 + h2) {
on10 = !on10;
}
}
// Draw the buttons/window shades
void display() {
rectMode(CORNER);
stroke(0);
if (on1) {
noFill();
tv.unmute();
}
else {
fill(0);
tv.mute();
}
rect(x1, y1, w, h); //top row window 1
if (on2) {
noFill();
bark.unmute();
// action2 = true;
}
else {
fill(0);
bark.mute();
}
rect(x2, y1, w, h);
// if (!action3 && millis()>timeNow3 + 2000) {
// on2 = !on2;
// action2 = false;
// }
if (on3) {
noFill();
on2 = true;
action3 = true;
trumpet.unmute();
// timeNow2 = millis();
}
else {
fill(0);
timeNow3= millis();
action3 = false;
trumpet.mute();
}
rect(x3, y1, w, h);
if (action3 && millis()>timeNow3 + threeSeconds) {
on3 = !on3;
}
if (on4) {
noFill();
on8 = true;
alarm.unmute();
}
else {
fill(0);
alarm.mute();
}
rect(x4, y1, w, h);
if (on5 || on6) {
noFill();
heyya.unmute();
}
else {
fill(0);
heyya.mute();
}
rect(x5, y1, w, h);
rect(x6, y1, w, h);
if (on7) {
noFill();
salsa.unmute();
}
else {
fill(0);
salsa.mute();
}
rect(x2, y2, w, h2); //bottom row window 7
if (on8) {
noFill();
alarm.unmute();
}
else {
fill(0);
alarm.mute();
}
rect(x3, y2, w, h2);
if (on9) {
noFill();
action9 = true;
vac.unmute();
}
else {
fill(0);
timeNow9= millis();
vac.mute();
}
rect(x5, y2, w, h2);
if (action9 && millis()>timeNow9 + fiveSeconds) {
on9 = !on9;
}
if (on10) {
noFill();
action10 = true;
pot.unmute();
}
else {
fill(0);
timeNow10= millis();
pot.mute();
}
rect(x6, y2, w, h2);
if (action10 && millis()>timeNow10 + threeSeconds) {
on10 = !on10;
}
}
}