Beginning Proccessing Questions
in
Programming Questions
•
1 year ago
Hi,
I'm having a few problems. First of all, I'm a beginner, so this is all very easy, but I'm just not sure how to use it yet.
PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
//PImage img5;
int temp;
int temp1;
void setup()
{
size(500,500);
background(220);
img = loadImage("harryWand2.gif");
img1 = loadImage("avada.jpg");
img2 = loadImage("voldemort.gif");
img3 = loadImage("expelliarmus.gif");
img4 = loadImage("bird.gif");
}
getO()
{
if (keyPressed)
{
if (key == 'o')
{
image(img4, temp - 170, temp1 - 147);
temp = mouseX;
temp1 = mouseY;
delay(1000);
temp--;
temp1--;
}
}
}
void draw()
{
background(220);
image(img, mouseX, mouseY);
if (keyPressed)
{
if (key == 'a')
{
image(img2, mouseX, mouseY);
image(img1, mouseX - 330, mouseY - 420);
}
}
if (mousePressed == true)
{
image(img3, mouseX - 330, mouseY - 420);
}
}
{
background(220);
image(img, mouseX, mouseY);
if (keyPressed)
{
if (key == 'a')
{
image(img2, mouseX, mouseY);
image(img1, mouseX - 330, mouseY - 420);
}
}
if (mousePressed == true)
{
image(img3, mouseX - 330, mouseY - 420);
}
}
So, I want, under key == 'o', for birds to appear and then move off screen. I can't work out how to make it update after every row and not after the loop is complete (I'm using draw()). Also, the program doesn't like temp-- or temp - 1 or temp -- 1, and I can't figure out how to subtract one from it.
Thank you!
1