We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › activating different array after a certain time
Page Index Toggle Pages: 1
activating different array after a certain time (Read 1365 times)
activating different array after a certain time
Jun 9th, 2010, 5:25pm
 
hello everyone, i've been having trouble trying to have my program run with a different set of images... also, do you guys know a way to have the new images start a few seconds after the first set ends? there're these few lines i mark with asteriscs ***** (the whole 'else' part of the if) that i added... it activates when the program finishes running all the images in the array... that's as far as i got. i also tried preparing a different array with different images, but when i go to find it inside that 'else', something really bizarre happens... any help is very much appreciated, i need the code for an interactive installation piece that i'm working on, thanks! (oh and i also include my data folder if you wanna check it out, the program's pretty estetic) (?) http://rapidshare.com/files/397259667/data.rar.html


PImage[] images = new PImage[9];
int cantImagenes = 9;

int[][] capas;
boolean[][] antes;

int ancho = 800;
int alto = 600;

PImage pantalla;

void setup(){
 size(ancho,alto);

 capas = new int[ancho][alto];
 antes = new boolean[ancho][alto];

 for(int i=0;i<images.length;i++){
   String s = (i+1)+".jpg";
   images[i] = loadImage(s);
 }

 pantalla = createImage( ancho , alto , RGB );
 pantalla.copy( images[0] , 0 , 0 , ancho , alto , 0 , 0 , ancho , alto );

 background(0);
}
void draw(){

 image( pantalla , 0 , 0 );

 for( int i=0 ; i<ancho ; i++ ){
   for( int j=0 ; j<alto ; j++ ){

     if( dist(i,j,mouseX,mouseY) < 50 ){ //mouse is over

       if( !antes[i][j] ){
         if( capas[i][j] < 8 ){
           capas[i][j]++;

           int cualCapa = capas[i][j];
           color c = images[ cualCapa ].get(i,j);

           pantalla.set( i , j , c );

         }
         else{
           rect(100,100,100,100);} **********
       }

       antes[i][j] = true;
     }
     else{ // the mouse is not over
       antes[i][j] = false;        
     }
   }
 }
}

Re: activating different array after a certain time
Reply #1 - Jun 10th, 2010, 1:39am
 
http://processing.org/discourse/yabb2/num_1276144004.html#0
Page Index Toggle Pages: 1