PImage not changing!
in
Programming Questions
•
1 year ago
Hello!
I made a simple program that is supposed to play a sound, show a picture of a gun, the gun about to fire, gun firing, and returns to the orignial picture rather quickly to simulate a simple animation. Here's the code:
- import ddf.minim.*;
PImage mage;
PImage mage2;
PImage mage2_2;
Minim minim;
AudioSample gun; - void setup()
{
size(500, 201, P2D);
// always start Minim before you do anything with it
minim = new Minim(this);
gun = minim.loadSample("Gunshot.wav", 2048);
} - void draw()
{
} - void mousePressed()
{
mage = loadImage("Gun.jpg");
mage2 = loadImage("Gun2.jpg");
mage2_2 = loadImage("Gun2_2.jpg");
gun.trigger();
image(mage2_2, 0, 0); delay(100);
image(mage2,0,0); delay(800);
image(mage2_2, 0, 0); delay(100);
image(mage, 0, 0);
} - void stop()
{
// always close Minim audio classes when you are done with them
gun.close();
minim.stop();
super.stop();
}
I have the audio file and pictures in a folder named "data" in the sketch folder. However, only the original picture of the gun ever appears. The other pictures never appear. The program compiles. The sound plays. Can anyone tell me what I am doing wrong?
Thanks
1