Random Snowflake animation with Array | UPDATE

edited November 2013 in Questions about Code

Hi there,

I'm glad you've opened this thread! I got one question regarding this simple code I made: (Outtake)

  z = z - 1;
  frameRate(60);
  zsnow = 0;

  for (int counter = 0; counter < z; counter++) { // z = 19
    xsnow[zsnow] += 120;
    println( xsnow[2] );
    zsnow ++;
  }

  loadPixels();
}; // Setup End

void draw() {
  updatePixels();

  ysnow[z] += 0.8;
  generiereSchnee (xsnow[0], ysnow[z]);
  generiereSchnee (xsnow[1], ysnow[z]);
  generiereSchnee (xsnow[2], ysnow[z]);
  generiereSchnee (xsnow[3], ysnow[z]);
  generiereSchnee (xsnow[4], ysnow[z]);
  generiereSchnee (xsnow[5], ysnow[z]);
  generiereSchnee (xsnow[6], ysnow[z]);
  generiereSchnee (xsnow[7], ysnow[z]);
  generiereSchnee (xsnow[8], ysnow[z]);
  generiereSchnee (xsnow[9], ysnow[z]);


  if (ysnow[z]>=height) {
    ysnow[z] = 0;
  }
}

Why is xsnow[] value for all [x] values = 120? It should actually start from 120 and then add 120 everytime the for loop goes thorugh, so that the snow in my draw will start at different x-coordinates.

Best Regards, iSpectra

Answers

Sign In or Register to comment.