I posted a few hours back about a sketch im working on where the user has a screen with a hardwood floor background and a camera and that once the user presses the space bar, the screen flashes and polaroids appear on the screen. So far everything works. Now the issue is if I want to create an array to make more than one polaroid appear. I would have about 9 set polaroids and the user would just press the space bar nine times until all pictures are visible on the screen.
Here's what I've got so far (picture.jpg is my polaroid picture)
float bx;
float by;
boolean overBox = false;
boolean locked = false;
boolean spacebarHasBeenPressed = false;
boolean flash = false;
float xOffset = 0.0;
float yOffset = 0.0;
PImage picture;//polaroids
PImage bg;//hardwoodfloor
PImage pcam;//camera
void setup()
{
size(900, 650);
bx = width/2.0;
by = height/2.0;
rectMode(RADIUS);
picture = loadImage("picture.jpg");
bg = loadImage("hardwood.jpg");
pcam = loadImage("pcam.png");
}
void draw()
{
background(bg);
image (pcam, 45, 330);
if(spacebarHasBeenPressed)
image (picture, bx, by);
if (mouseX > bx-0 && mouseX < bx+140 &&
mouseY > by-0 && mouseY < by+160) {
overBox = true;
if(!locked) {
}
} else {
overBox = false;
}
}
//Press spacebar to activate camera flash and get polaroid
I have a sketch that I'm working on and I can't go further without fixing this problem.
The function of the sketch is that there will be a camera on the corner and when you press the space bar, the screen will flash and polaroids will appear and accumulate on the screen. Once the polaroid shows up, users can drag them around on the screen and place them however they want to. I am able to make the polaroid appear on my sketch but only if I hold it down. What would I have to do to be able to just press the spacebar and make it draw a fixed polaroid?