Random images only appearing in one part of the screen

edited September 2015 in Questions about Code

Hello, I'm trying to get the images of these apples to appear at random across the screen but they only seem to be appearing in one section when I run it. I think its something to do with the random() function but can't figure it out - any help would be appreciated :)

PImage appleImg = loadImage("http://" + "i.imgur.com/p9E3sqS.png");

void setup(){
  size(800,600);
  background(250, 250, 150);
}

void draw() {
  frameRate(2);
  for (int i = 0; i < 1; i++) {
    int x = int(random(800));
    int y = int(random(600));
    image(appleImg, x, y);
  }
}

Thank you!

Answers

Sign In or Register to comment.