Mat Project Coding

The following is the coding that my group is using for the interactive floor mat project.

I did the coding for the section with 0-6 images, Cristian did the coding for the section with #758D7F images, a-i coding was done by Tyler, Brian did the coding for the Center images, Adrian did the coding for a1-g7 images, and Brianna did the bri1-bri6 images. Any miscellaneous coding was done by me.

 

int numFrames = 11;

int frame = 0;
PImage[] images = new PImage[numFrames];
long timer;
float framespeed = 120.00;

void setup () {
size (1000,755);
images[0] = loadImage (“#758D7F_1.png”);
images[1] = loadImage (“#758D7F_2.png”);
images[2] = loadImage (“#758D7F_3.png”);
images[3] = loadImage (“#758D7F_4.png”);
images[4] = loadImage (“#758D7F_5.png”);
images[5] = loadImage (“#758D7F_6.png”);
images[6] = loadImage (“#758D7F_7.png”);
images[7] = loadImage (“#758D7F_8.png”);
images[8] = loadImage (“#758D7F_9.png”);
images[9] = loadImage (“#758D7F_10.png”);
images[10] = loadImage (“#758D7F_11.png”);

timer = millis();
imageMode (CENTER);
}

void draw ()
{
if ((keyPressed == true) && (key == ‘1’)){
images[0] = loadImage(“0.png”);
images[1] = loadImage(“1.png”);
images[2] = loadImage(“2.png”);
images[3] = loadImage(“3.png”);
images[4] = loadImage(“4.png”);
images[5] = loadImage(“5.png”);
images[6] = loadImage(“6.png”);

background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

if ((keyPressed == true) && (key == ‘2’)){
images[0] = loadImage(“a.png”);
images[1] = loadImage(“b.png”);
images[2] = loadImage(“c.png”);
images[3] = loadImage(“d.png”);
images[4] = loadImage(“e.png”);
images[5] = loadImage(“f.png”);
images[6] = loadImage(“g.png”);
images[7] = loadImage(“h.png”);
images[8] = loadImage(“i.png”);

background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

if ((keyPressed == true) && (key == ‘3’)){
images[0] = loadImage(“Center1.png”);
images[1] = loadImage(“Center2.png”);
images[2] = loadImage(“Center3.png”);
images[3] = loadImage(“Center4.png”);
images[4] = loadImage(“Center5.png”);
images[5] = loadImage(“Center6.png”);

background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

if ((keyPressed == true) && (key == ‘4’)){
images[0] = loadImage(“a1.png”);
images[1] = loadImage(“b2.png”);
images[2] = loadImage(“c3.png”);
images[3] = loadImage(“d4.png”);
images[4] = loadImage(“e5.png”);
images[5] = loadImage(“f6.png”);
images[6] = loadImage(“g7.png”);
background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

if ((keyPressed == true) && (key == ‘5’)){
images[0] = loadImage(“bri1.png”);
images[1] = loadImage(“bri2.png”);
images[2] = loadImage(“bri3.png”);
images[3] = loadImage(“bri4.png”);
images[4] = loadImage(“bri5.png”);
images[5] = loadImage(“bri6.png”);

background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

background (0);
if (millis() – timer > framespeed) {
timer = millis();
frame ++;
}
if (frame == numFrames) {
frame = 0;
}
image(images[frame], width/2, height/2);
}

Advertisements
This entry was posted in Non-Timebased, Writing and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s