I wanna the program paused when I press the key and the number currently on the screen is immediately stop and appear on the screen.but for my code when the program paused the number disappeared.Can anyone help with my code please
BTW can anyone help me to do one more step that's every number means a string So that make the output is a string instead of the number and the order of the string should be random
I'm new in processing and for my code I wanna display a picture after the mouse released and the picture can't be same for each time .can anyone help me to change the code.also there is a outofmemory error.
Need help!!!
import ddf.minim.*;
Minim minim;
//AudioPlayer player;
ParticleSystem ps;
PImage[] story = new PImage [23];
PImage a;
void setup() {
size(800 , 600) ;
minim = new Minim (this);
player = minim.loadFile ("music1.mp3");
player.loop();
ps = new ParticleSystem(1, new PVector(width/2,height/2,0));
}
void draw(){
// a=loadImage("a1.jpg");
// background(a);
int randomNum = (int) random(23);
story[randomNum]=loadImage(randomNum+".jpg");
if
if(mousePressed){
image(story[randomNum],0,0);
}
ps.run();
ps.addParticle(mouseX,mouseY);
}
class ParticleSystem {
ArrayList particles;
PVector origin;
ParticleSystem(int num, PVector v) {
particles = new ArrayList();
origin = v.get();
for (int i = 0; i < num; i++) {
particles.add(new Particle(origin));
}
}
void run() {
for (int i = particles.size()-1; i >= 0; i--) {
Particle p = (Particle) particles.get(i);
p.run();
if (p.dead()) {
particles.remove(i);
}
}
}