hwoarang69 11 Newbie Poster

first buid array with images's --90 images

PImage pic[];

void setup()
{
  size(900,900);

  pic = new PImage[90];
  for(int i = 0; i < 90; i++)
  {
    pic[i] = loadImage("section_"+i+".jpg");
  }
  frameRate(0.5);
  smooth();
}

than prnt image on screen

int i = 0;
int counter = 0;
int flag = 0;
void draw()
{
  int rand = int (random(89));

  if(counter == 3)
  {
  println("randoom"+rand+".jpg");  
    image(pic[rand],0, 0);               // dont work hererererrreerererrererr

    counter = 0;
    flag = 1;       //print random image than skip i
  }

  if(flag == 0)
  {
    if(i >= 90)
      {
         i = 0;
      }
      image(pic[i],0,0);
      println("section"+i+".jpg");
      i++;
      counter++;
  }
  else
  {
      i++;
       if(i >= 90)
       {
         i = 0;
       }
         image(pic[i],0,0);
         println("section"+i+".jpg");
         counter++;
         i++;
         flag = 0;
  }
}

problem is in this line

println("randoom"+rand+".jpg");  
        image(pic[rand],0, 0);               // dont work hererererrreerererrererr

the rand variable is seem to be working but "image(pic[rand],0,0)" is not. any idea's?

it is skiping the line --image(pic[rand],0, 0);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.