Tree tree1;
Tree tree2;
Tree tree3;
TreeDry treeDry1;
TreeDry treeDry2;
TreeDry treeDry3;
int sandValue = 4000;
Sand[] sand = new Sand[sandValue];
void setup() {
size(400, 400);
rectMode(CENTER);
tree1 = new Tree(175, 120);
tree2 = new Tree(325, 150);
tree3 = new Tree(55, 180);
treeDry1 = new TreeDry(175, 120);
treeDry2 = new TreeDry(325, 150);
treeDry3 = new TreeDry(55, 180);
for (int i = 0; i < sand.length; i++) {
sand[i] = new Sand();
}
}
void draw() {
background(236, 200, 148);
Pond();
PondDry();
tree1.displayTree();
tree2.displayTree();
tree3.displayTree();
treeDry1.displayTreeDry();
treeDry2.displayTreeDry();
treeDry3.displayTreeDry();
for (int i = 0; i < sand.length; i++) {
sand[i].display();
sand[i].update();
}
dialog();
}void dialog() {
if (mouseX < 133 && mousePressed == true) {
System.out.println("WATER! Finally after all this time!");
System.out.println(" ");
delay(100);
}
else if (mouseX > 133 && mouseX < 233 && mousePressed == true) {
System.out.println("The sandstorm is so thick I'm losing sight of the oasis.");
System.out.println(" ");
delay(100);
}
else if (mouseX > 233 && mousePressed == true) {
System.out.println("Of course... It was just another mirage.");
System.out.println(" ");
delay(100);
}
}
void Pond() {
noStroke();
fill(145, 200, 230, 300-(mouseX*1.5));
rect(180, 195, 80, 10);
rect(230, 205, 20, 10);
rect(250, 215, 20, 10);
rect(110, 215, 20, 10);
rect(130, 205, 20, 10);
rect(270, 225, 20, 10);
fill(152, 215, 255, 300-(mouseX*1.5));
rect(180, 230, 120, 40);
rect(180, 220, 80, 40);
rect(180, 230, 160, 20);
rect(200, 255, 80, 10);
rect(270, 235, 20, 10);
rect(250, 245, 20, 10);
}void PondDry() {
noStroke();
fill(179, 153, 116, -300+(mouseX*1.5));
rect(180, 195, 80, 10);
rect(230, 205, 20, 10);
rect(250, 215, 20, 10);
rect(110, 215, 20, 10);
rect(130, 205, 20, 10);
rect(270, 225, 20, 10);
fill(193, 165, 124, -300+(mouseX*1.5));
rect(180, 230, 120, 40);
rect(180, 220, 80, 40);
rect(180, 230, 160, 20);
rect(200, 255, 80, 10);
rect(270, 235, 20, 10);
rect(250, 245, 20, 10);
}class Sand {
PVector location;
PVector velocity;
color sandDensity = color(230, 195, 145, random(100, 255));
Sand() {
location = new PVector(random(-400, -5), random(0, 400));
velocity = new PVector(random(2, 4), random(-0.1, 0.1));
}
void display() {
rectMode(CENTER);
noStroke();
fill(sandDensity);
rect(location.x, location.y, 5, 5);
}
void update() {
location.add(velocity);
if ((location.x > width) || (location.y > height)) {
location.x = random(-50, -5);
location.y = random(0, 400);
}
}
}class Tree {
float posX;
float posY;
Tree(float x, float y) {
posX = x;
posY = y;
}
void displayTree() {
noStroke();
fill(122, 103, 76, 300-(mouseX*1.5));
rect(posX, posY, 10, 80);
fill(92, 122, 76, 300-(mouseX*1.5));
rect(posX, posY-35, 70, 10);
rect(posX+5, posY-55, 120, 10);
rect(posX-5, posY-45, 120, 10);
rect(posX+15, posY-65, 40, 10);
rect(posX+60, posY-35, 30, 10);
rect(posX+35, posY-25, 20, 10);
rect(posX-60, posY-35, 10, 10);
rect(posX-35, posY-25, 20, 10);
rect(posX-40, posY-15, 10, 10);
}
void Coconut() {
fill(92, 122, 76, 300-(mouseX*1.5));
rect(posX, posY-35, 70, 10);
}
}class TreeDry {
float posX;
float posY;
TreeDry(float x, float y) {
posX = x;
posY = y;
}
void displayTreeDry() {
noStroke();
fill(122, 103, 76, -300+(mouseX*1.5));
rect(posX, posY, 10, 80);
fill(122, 103, 76, -300+(mouseX*1.5));
rect(posX+10, posY-35, 30, 10);
rect(posX-5, posY-25, 20, 10);
}
}