Doesn’t Stick

Right I’ve finally got the coding complete I ran into a fair few errors along the way but it finally works out alright. One of the main problems was when i tried to set up the background image of Matt’s blanked out face the facial features no longer stayed put on top they merely stayed there for the second the key was pressed. After some not so subtle prompting from Mark I realised my error before I was declaring placing the image within the keypresses and declaring the random picking in the draw cycle.
void draw(){
background(bg);
leye=int(random(5));
reye=int(random(5)+6);
mouth=int(random(5)+11);
nose=int(random(5)+16);

//int rand = 0;

}

void keyPressed(){
if (key == 'l' || key == 'L') {
image(features[leye],0,0, 1224,1162);
}
else if (key == 'r' || key == 'R') {
image(features[reye],0,0,1224,1162);
}
else if (key == 'm' || key == 'M') {
image(features[mouth],0,0,1224,1162);
}
else if (key == 'n' || key == 'N') {
image(features[nose],0,0,1224,1162);
}
else if (key == 's' || key == 'S') {
saveFrame("face-####.tif");
}
}

When in fact i needed to be doing it the other way around. Once I had done this it worked perfectly and I ended up with this

.

June 10th, 2008 - Posted in Double Project | | 0 Comments

Leave a reply

You must be logged in to post a comment.