For loop not working

Hi! So I have been working on a project that requires me to use a 2D array. I have been trying to loop over this with the for loop, but it doesn’t seem to be working. Here’s my code.

//World Variables
int seed; // The seed used by the program to generate the world. 
int worldW, worldH; // The width and height of the world
Tile[][] world; // The world array
boolean worldGenerated;
// Camera Variables
float zoom; // How zoomed int the camera is. 
PVector cam; // The camera's location

void setup() {
  size(1366, 768); // The size of the window. I would recommend using your screen's native resolution. 
  
  // Seed Variables
  seed = 1234;
  randomSeed(seed);
  
  // World Variables
  worldW = 1000;
  worldH = 1000;
  world = new Tile[worldW][worldH];
  worldGenerated = false;
  
  // Camera Variables
  zoom = 0.2;
  cam = new PVector(0, 0);
  keysDown = new ArrayList<String>();
 
  background(0);
}

void draw() {
  background(0);
  if (!worldGenerated) {
    generateWorld();
  }

  for (int x = 0; x > worldW; x = x + 1) {
    for (int y = 0; y > worldH; y = y + 1) {
       world[x][y].drawTile();
    }
  }
  if (keyPressed) {
    if (key == '-') {
      zoom += 0.001;
    } else if (key == '=') {
      zoom -= 0.001;
    } else if (key == 'w') {
      cam.y -= 1;
    } else if (key == 's') {
      cam.y += 1;
    } else if (key == 'd') {
      cam.x += 1;
    } else if (key == 'a') {
      cam.x -= 1;
    }
  }
}

void generateWorld() {
  for (int x = 0; x > worldW; x = x + 1) {
    print("test");
    for (int y = 0; y > worldH; y = y + 1) {
      world[x][y] = new Tile(x * 10, y * 10, 10, 10, 10);
    }
  }
  worldGenerated = true;
}

Tile:

class Tile {
  float tHeat, tHumitity, tHeight;
  PVector location;
  Tile(int x, int y, float tHeat, float tHumitity, float tHeight) {
    this.tHeat = tHeat;
    this.tHumitity = tHumitity;
    this.tHeight = tHeight;
    this.location = new PVector(x, y);
  }
  
  public void drawTile() {
    noStroke();
    fill(map(tHeat, 0, 1, 0, 255), map(tHeight, 0, 1, 0, 255), map(tHumitity, 0, 1, 0, 255));
    rect((this.location.x + cam.x) / zoom, (this.location.y + cam.y) / zoom, 10 / zoom, 10 / zoom);
  }
}

Can you please help me?
Thanks!

1 Like

I think it’s wrong to have it >

you want <

https://www.processing.org/reference/for.html

1 Like

Oops! Thanks!

1 Like

Think: do this as long as