// -- object oriented toy -- definitely not a harvest moon clone -- //
// -- By Reilly MacKay -- //
// -- Playing instructions are printed in the cosole -- //
// -- There is no winning or losing, just planting vegetables and making money -- //
// -- Have Fun! -- //
boolean up = false;
boolean down = false;
boolean left = false;
boolean right = false;
boolean fast = false;
boolean is1planted = false;
boolean is1watered = false;
boolean is2planted = false;
boolean is2watered = false;
boolean is3planted = false;
boolean is3watered = false;
boolean is4planted = false;
boolean is4watered = false;
boolean is5planted = false;
boolean is5watered = false;
boolean is6planted = false;
boolean is6watered = false;
boolean potato = false;
boolean turnip = false;
boolean carrot = false;
boolean corn = false;
boolean tomato = false;
boolean onion = false;
PVector charaPos = new PVector(300, 200);
PFont txt;
float rlegX = charaPos.x + 5;
float llegX = charaPos.x - 5;
float time1x = 20;
float time2x = 20;
float time3x = 40;
float time4x = 40;
float time5x = 60;
float time6x = 60;
int inventorynum;
int cyclenum1 = 0;
int cyclenum2 = 0;
int cyclenum3 = 0;
int cyclenum4 = 0;
int cyclenum5 = 0;
int cyclenum6 = 0;
int counter = 0; //for money
int potseeds;
int turseeds;
int carseeds;
int corseeds;
int tomseeds;
int oniseeds;
//menu variables
int buttons = 150;
int buttonx = 90;
int buttony = 60;
int [] inventory = {1, 2, 3, 4, 5, 6, 7};
Menu menu1 = new Menu();
Menu menu2 = new Menu();
Menu menu3 = new Menu();
Menu menu4 = new Menu();
Item item1 = new Item();
Item item2 = new Item();
Item item3 = new Item();
Shed shed1 = new Shed();
Ground ground1 = new Ground();
Ground ground2 = new Ground();
Fence fence1 = new Fence();
Fence fence2 = new Fence();
Fence fence3 = new Fence();
Fence fence4 = new Fence();
Plant plant1 = new Plant();
Chara player1 = new Chara();
Plant plant2 = new Plant();
//get ready to read the least optimised code known to man
void setup(){
size(600, 400);
smooth();
//instructions for player
println("HOW TO PLAY:");
println("Use the arrow keys to move the player character around the field. Hold down 'Z' to increase walking ");
println("speed. Use 'A' and 'S' to scroll through your inventory, located at the top right of the screen.");
println("The item in the large circle is the item currently equipped, and scrolling with 'S' gives you a preview");
println("of the next 2 items. To use the currently equipped item, press 'X'. You can also press 'X' to pick the");
println("plants once they're fully grown and sell them for money. With this money, you can buy more seeds for new");
println("plants. To do so, walk up to the shed at the top of the yard to access the shop, which you navigate with");
println("the mouse. To exit the shop, walk away from the shed. To interact with the fields you must stand between");
println("them. You must plant seeds before you can water them, and you may only plant them in specific plots of land.");
println("Here is a legend:");
println(" |stand here| ");
println(" v v ");
println(" CARROTS POTATOES ");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println(" ");
println(" |stand here| ");
println(" v v ");
println(" CORN TOMATOES ");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println(" ");
println(" |stand here| ");
println(" v v ");
println(" ONIONS TURNIPS ");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println("XXX XXX XXX XXX");
println(" ");
//sets so that player has access to only 1 type of plant at the beginning
potseeds = 0;
turseeds = 0;
carseeds = 1;
corseeds = 0;
tomseeds = 0;
oniseeds = 0;
//sets the inventory index to 0, which equals the watering can
inventorynum = inventory[0];
}
void draw() {
background(255);
plant2.Timers();
ground1.drawGrass();
ground2.drawDirt();
plant1.drawPlants();
fence1.drawBackFence();
fence3.drawLeftFence();
fence4.drawRightFence();
shed1.drawShed();
player1.drawChara();
fence2.drawFrontFence();
item1.drawBG();
item2.drawInv();
item3.drawMoney();
menu1.drawMenu();
menu3.drawUpdate();
menu2.drawButtons();
}
void keyPressed() {
//deals with player movement and inventory navigation
if (keyCode == UP) {
up = true;
down = false;
left = false;
right = false;
}
else if (keyCode == LEFT) {
up = false;
down = false;
left = true;
right = false;
}
else if (keyCode == DOWN) {
up = false;
down = true;
left = false;
right = false;
}
else if (keyCode == RIGHT) {
up = false;
down = false;
left = false;
right = true;
}
else if (keyCode == 'Z') {
fast = true;
}
else if (keyCode == 'S') {
inventorynum = inventorynum + 1;
if (inventorynum > 7) {
inventorynum = 1;
}
if (inventorynum < 1) {
inventorynum = 7;
}
}
else if (keyCode == 'A') {
inventorynum = inventorynum - 1;
if (inventorynum > 7) {
inventorynum = 1;
}
if (inventorynum < 1) {
inventorynum = 7;
}
}
}
void keyReleased () {
if (keyCode == UP) {
up = false;
down = false;
left = false;
right = false;
}
else if (keyCode == LEFT) {
up = false;
down = false;
left = false;
right = false;
}
else if (keyCode == DOWN) {
up = false;
down = false;
left = false;
right = false;
}
else if (keyCode == RIGHT) {
up = false;
down = false;
left = false;
right = false;
}
else if (keyCode == 'z') {
fast = false;
}
else if (keyCode == 'Z') {
fast = false;
}
}
void mousePressed() {
//menu function (i.e purchasing)
if (charaPos.x >= 50 && charaPos.x <= 130 && charaPos.y <= 55) {
if (mouseX >= buttonx && mouseX <= buttonx+110 && mouseY >= buttony && mouseY <= buttony+120 && counter >= 40) {
counter = counter - 40;
carseeds = carseeds + 1;
} else if (mouseX >= buttonx+buttons && mouseX <= buttonx+buttons+110 && mouseY >= buttony && mouseY <= buttony+120 && counter >= 50) {
counter = counter - 50;
oniseeds = oniseeds + 1;
} else if (mouseX >= buttonx+(buttons*2) && mouseX <= buttonx+(buttons*2)+110 && mouseY >= buttony && mouseY <= buttony+120 && counter >= 70) {
counter = counter - 70;
tomseeds = tomseeds + 1;
}
//row2
else if (mouseX >= buttonx && mouseX <= buttonx+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130 && counter >= 40) {
counter = counter - 40;
corseeds = corseeds + 1;
} else if (mouseX >= buttonx+buttons && mouseX <= buttonx+buttons+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130 && counter >= 50) {
counter = counter - 50;
potseeds = potseeds + 1;
} else if (mouseX >= buttonx+(buttons*2) && mouseX <= buttonx+(buttons*2)+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130 && counter >= 70) {
counter = counter - 70;
turseeds = turseeds + 1;
}
}
}class Chara {
//draw the player character and dictates how they appears depending on the direction they're going. Also prevents the player from going outside the fence
void drawChara() {
quad(charaPos.x-11, charaPos.y, charaPos.x+11, charaPos.y, charaPos.x+3, charaPos.y+11, charaPos.x-3, charaPos.y+11);
stroke(216, 177, 125);
fill(234, 199, 152);
ellipse(charaPos.x, charaPos.y, 20, 20);
noStroke();
fill(206, 81, 92);
quad(charaPos.x-5, charaPos.y+10, charaPos.x+5, charaPos.y+10, charaPos.x+7, charaPos.y+20, charaPos.x-7, charaPos.y+20);
quad(charaPos.x-5, charaPos.y+10, charaPos.x-5, charaPos.y+14, llegX-4, charaPos.y+18, llegX-6, charaPos.y+18);
quad(charaPos.x+5, charaPos.y+10, charaPos.x+5, charaPos.y+14, rlegX+4, charaPos.y+18, rlegX+6, charaPos.y+18);
fill(75, 54, 55);
triangle(charaPos.x-7, charaPos.y+20, llegX, charaPos.y+30, charaPos.x, charaPos.y+20);
triangle(charaPos.x+7, charaPos.y+20, rlegX, charaPos.y+30, charaPos.x, charaPos.y+20);
fill(15, 11, 10);
//moves the character up
if (up == true) {
charaPos.y = charaPos.y - 1;
llegX = charaPos.x - 5;
rlegX = charaPos.x + 5;
if (fast == true) {
charaPos.y = charaPos.y - 2;
}
}
//moves the character down
else if (down == true) {
charaPos.y = charaPos.y + 1;
llegX = charaPos.x - 5;
rlegX = charaPos.x + 5;
if (fast == true) {
charaPos.y = charaPos.y + 2;
}
}
//moves the legx position so that they appear to be going sideways. move the character to the left
else if (left == true) {
charaPos.x = charaPos.x - 1;
llegX = charaPos.x;
rlegX = charaPos.x;
if (fast == true) {
charaPos.x = charaPos.x - 2;
llegX = charaPos.x;
rlegX = charaPos.x - 1;
}
}
//moves the legx position so that they appear to be going sideways. move the character to the right
else if (right == true) {
charaPos.x = charaPos.x + 1;
llegX = charaPos.x;
rlegX = charaPos.x;
if (fast == true) {
charaPos.x = charaPos.x + 2;
llegX = charaPos.x + 1;
rlegX = charaPos.x;
}
}
//gamespace binding
if (charaPos.y >= 346) {
charaPos.y = 346;
llegX = charaPos.x - 5;
rlegX = charaPos.x + 5;
}
else if (charaPos.y <= 46) {
charaPos.y = 46;
llegX = charaPos.x - 5;
rlegX = charaPos.x + 5;
}
else if (charaPos.x <= 35) {
charaPos.x = 35;
llegX = charaPos.x;
rlegX = charaPos.x;
}
else if (charaPos.x >= 567) {
charaPos.x = 567;
llegX = charaPos.x;
rlegX = charaPos.x;
}
}
}class Fence {
//essentially the game space. It is the binding box within which the player can move
//while loops and 4 functions for each side (back, left, right, and front in that order)
void drawBackFence() {
int space = 6;
int y = 46;
int x = 20;
int w = 4;
int h = 16;
while (x <= 574) {
fill(169, 116, 52);
rect(x, y, w, h);
ellipse(x+2, y, w, w);
fill(108, 55, 3);
rect(x+4, y+2, 2, 4);
rect(x+4, y+8, 2, 4);
x = x + space;
}
fill(169, 116, 52);
rect(578, y, w, h);
ellipse(580, y, w, w);
}
void drawLeftFence() {
int spacel = 6;
int yl = 46;
int xl = 20;
int wl = 4;
int hl = 16;
while (yl <= 366) {
fill(169, 116, 52);
rect(xl, yl, wl, hl);
fill(108, 55, 3);
rect(xl, yl+2, wl, 4);
fill(169, 116, 52);
ellipse(xl+2, yl, wl, wl);
fill(70);
yl = yl + spacel;
}
}
void drawRightFence() {
int spacer = 6;
int yr = 46;
int xr = 578;
int wr = 4;
int hr = 16;
while (yr <= 366) {
fill(169, 116, 52);
rect(xr, yr, wr, hr);
fill(108, 55, 3);
rect(xr, yr+2, wr, 4);
fill(169, 116, 52);
ellipse(xr+2, yr, wr, wr);
fill(108, 55, 3);
yr = yr + spacer;
}
}
void drawFrontFence() {
int spacef = 6;
int yf = 366;
int xf = 20;
int wf = 4;
int hf = 16;
while (xf <= 574) {
fill(169, 116, 52);
rect(xf, yf, wf, hf);
ellipse(xf+2, yf, wf, wf);
fill(108, 55, 3);
rect(xf+4, yf+2, 2, 4);
rect(xf+4, yf+8, 2, 4);
xf = xf + spacef;
}
fill(169, 116, 52);
rect(578, yf, wf, hf);
ellipse(580, yf, wf, wf);
}
}class Ground {
//creates the backdrop
int square = 22;
int dx = 90;
int dy = 110;
//drawGrass - uses a for loop to tile a grass pattern (inspired by the grass tiles of pokemon FR/LG)
void drawGrass(){
fill(107, 216, 79);
rect(0, 0, 600, 400);
//loop for grass texture
//dark
//make less vibrant
int tile = 32;
int gx = 0;
int gy = 3;
for (gx = 0; gx < 600; gx = gx + tile) {
for (gy = 3; gy < 400; gy = gy + tile) {
fill(52, 188, 34);
rect(gx, gy, 1, 1);
rect(gx+1, gy+1, 1, 1);
rect(gx+3, gy-1, 1, 2);
rect(gx+6, gy, 1, 1);
rect(gx+5, gy+1, 1, 1);
rect(gx+2, gy+20, 1, 1);
rect(gx+3, gy+21, 1, 1);
rect(gx+5, gy+19, 1, 2);
rect(gx+8, gy+20, 1, 1);
rect(gx+7, gy+21, 1, 1);
rect(gx+10, gy+12, 1, 1);
rect(gx+11, gy+13, 1, 1);
rect(gx+13, gy+11, 1, 2);
rect(gx+16, gy+12, 1, 1);
rect(gx+15, gy+13, 1, 1);
rect(gx+20, gy+22, 1, 1);
rect(gx+21, gy+23, 1, 1);
rect(gx+23, gy+21, 1, 2);
rect(gx+26, gy+22, 1, 1);
rect(gx+25, gy+23, 1, 1);
//mid
fill(128, 228, 110);
rect(gx+10, gy+6, 1, 1);
rect(gx+11, gy+7, 1, 1);
rect(gx+13, gy+5, 1, 2);
rect(gx+16, gy+6, 1, 1);
rect(gx+15, gy+7, 1, 1);
rect(gx+24, gy, 1, 1);
rect(gx+25, gy+1, 1, 1);
rect(gx+27, gy-1, 1, 2);
rect(gx+30, gy, 1, 1);
rect(gx+29, gy+1, 1, 1);
//light
fill(162, 233, 138);
rect(gx+9, gy+25, 1, 1);
rect(gx+10, gy+26, 1, 1);
rect(gx+12, gy+24, 1, 2);
rect(gx+15, gy+25, 1, 1);
rect(gx+14, gy+26, 1, 1);
}
}
}
//drawDirt - where the plants will visually appear. Uses for loops to tile 3x3 squares. Soil turns darker if the plant it is responsible for is watered
void drawDirt() {
////CARROT
//------PLOT 1
if (is1watered == false) {
//lighter
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
strokeWeight(1);
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 2
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is1watered == true) {
//darker
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
strokeWeight(1);
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 2
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
//////POTATO
if (is4watered == false) {
//------PLOT 3
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 4
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is4watered == true) {
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 4
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 110; dy < 170; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
/////////////////////////////////////////////////////////////////
///////CORN
if (is2watered == false) {
////------PLOT 5
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 6
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is2watered == true) {
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 6
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
/////////TOMATO
if (is5watered == false) {
//------PLOT 7
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 8
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is5watered == true) {
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 8
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 190; dy < 250; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
/////////////////////////////////////////////////////////////////
////////ONION
if (is3watered == false) {
//------PLOT 9
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 10
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is3watered == true) {
for (dx = 90; dx < 150; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 10
for (dx = 210; dx < 270; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
///TURNIP
if (is6watered == false) {
//------PLOT 11
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 12
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
//turn darker when watered using if statement
//add some kind of timer so it dries
stroke(255, 215, 121);
fill(232, 216, 80);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(232, 184, 72);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(240, 200, 80);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
else if (is6watered == true) {
for (dx = 330; dx < 390; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
//------PLOT 12
for (dx = 450; dx < 510; dx = dx + square) {
for (dy = 270; dy < 330; dy = dy + square) {
//turn darker when watered using if statement
//add some kind of timer so it dries
stroke(206, 172, 131);
fill(178, 128, 102);
rect(dx, dy, 19, 19, 4);
noStroke();
fill(162, 117, 82);
rect(dx+2, dy+3, 16, 3, 4);
rect(dx+2, dy+9, 16, 3, 4);
rect(dx+2, dy+15, 16, 3, 4);
fill(139, 99, 67);
rect(dx+2, dy+3, 16, 2, 4);
rect(dx+2, dy+9, 16, 2, 4);
rect(dx+2, dy+15, 16, 2, 4);
}
}
}
noStroke();
}
}class Item {
//inventory UI, scroll with A and S. Item in big circle is 'equipped' as the visual corresponds to a number, which gives it a function
//drawBG just draws the semitransparent menu background
void drawBG() {
fill(209, 239, 255, 140);
ellipse(550, 50, 100, 100);
ellipse(480, 20, 40, 40);
ellipse(480, 60, 30, 30);
ellipse(495, 90, 20, 20);
fill(118, 138, 188);
ellipse(489, 90, 3, 3);
ellipse(495, 90, 3, 3);
ellipse(501, 90, 3, 3);
}
void drawInv() {
//drawInv draws the inventory items based on the number that the inventory array currently equals
//1 is watering can, and 2-7 and the seeds available in alphabetical order. Graphic is just a visual representation
//ifs for colour, i.e if you have 0 of an item, its greyscale.
if (inventorynum == inventory[0]) {
strokeWeight(4);
stroke(38, 34, 88);
fill(0, 0, 0, 0);
ellipse(572, 60, 23, 23);
noStroke();
//body
fill(35, 55, 103);
quad(524, 65, 564, 80, 574, 43, 542, 31);
//handle
fill(118, 138, 188);
quad(552, 74, 557, 76, 566, 41, 562, 40);
//spout
fill(38, 34, 88);
quad(534, 57, 542, 42, 516, 30, 514, 35);
fill(209, 239, 255);
strokeWeight(1);
stroke(38, 34, 88);
ellipse(515, 34, 10, 20);
noStroke();
fill(118, 138, 188);
ellipse(514.5, 34, 2, 2);
ellipse(511, 33.5, 2, 2);
ellipse(518, 34.5, 2, 2);
ellipse(514.5, 28, 2, 2);
ellipse(512, 30, 2, 2);
ellipse(517, 31, 2, 2);
ellipse(514, 40, 2, 2);
ellipse(512, 37, 2, 2);
ellipse(517, 38, 2, 2);
//carrot smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(252, 142, 5);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
//corn smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(252, 240, 105);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
else if (inventorynum == inventory[1]) {
//carrot - ellipse(550, 50, 100, 100);
if (carseeds >= 1) {
//color
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(252, 142, 5);
ellipse(537, 55, 12, 12);
ellipse(545.5, 68, 4, 4);
quad(533, 60, 543, 54, 547, 66, 544, 69);
fill(52, 188, 34);
triangle(527, 52, 528, 49, 536, 52);
triangle(536, 45, 538, 43, 536, 52);
triangle(530, 45, 532, 44, 536, 52);
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (carseeds == 0) {
//monochrome
fill(150);
ellipse(549, 54, 50, 50);
fill(130);
ellipse(537, 55, 12, 12);
ellipse(545.5, 68, 4, 4);
quad(533, 60, 543, 54, 547, 66, 544, 69);
fill(100);
triangle(527, 52, 528, 49, 536, 52);
triangle(536, 45, 538, 43, 536, 52);
triangle(530, 45, 532, 44, 536, 52);
fill(100);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//corn smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(252, 240, 105);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
//onion smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(162, 13, 65);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
else if (inventorynum == inventory[2]) {
if (corseeds >= 1) {
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(162, 233, 138);//green
quad(548, 66, 551, 69, 547, 72, 544, 68);
ellipse(543, 63, 12, 12);
fill(252, 240, 105); //yellow
ellipse(533, 50, 4, 4);
ellipse(537, 52, 4, 4);
ellipse(533, 54, 4, 4);
ellipse(540, 55, 4, 4);
ellipse(537, 57, 4, 4);
ellipse(534, 58, 4, 4);
ellipse(543, 58, 4, 4);
ellipse(540, 60, 4, 4);
ellipse(536.5, 62, 4, 4);
ellipse(546, 61, 4, 4);
ellipse(543, 63, 4, 4);
ellipse(539, 65, 4, 4);
ellipse(547, 65, 4, 4);
ellipse(543, 67, 4, 4);
fill(162, 233, 138);//green
quad(545, 70, 547, 66, 532, 60, 528, 61);
quad(550, 68, 546, 66, 542, 54, 544, 49);
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (corseeds == 0) {
fill(150);
ellipse(549, 54, 50, 50);
fill(100);//green
quad(548, 66, 551, 69, 547, 72, 544, 68);
ellipse(543, 63, 12, 12);
fill(130); //yellow
ellipse(533, 50, 4, 4);
ellipse(537, 52, 4, 4);
ellipse(533, 54, 4, 4);
ellipse(540, 55, 4, 4);
ellipse(537, 57, 4, 4);
ellipse(534, 58, 4, 4);
ellipse(543, 58, 4, 4);
ellipse(540, 60, 4, 4);
ellipse(536.5, 62, 4, 4);
ellipse(546, 61, 4, 4);
ellipse(543, 63, 4, 4);
ellipse(539, 65, 4, 4);
ellipse(547, 65, 4, 4);
ellipse(543, 67, 4, 4);
fill(100);//green
quad(545, 70, 547, 66, 532, 60, 528, 61);
quad(550, 68, 546, 66, 542, 54, 544, 49);
fill(100);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//onion smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(162, 13, 65);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
//potato smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(216, 202, 181);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
else if (inventorynum == inventory[3]) {
if (oniseeds >= 1) {
//onion
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(52, 188, 34);
triangle(540, 60, 530, 50, 533, 48);
triangle(533, 52, 532, 45, 530, 46);
triangle(532, 52, 527, 50, 529, 48);
fill(162, 13, 65);
ellipse(540, 60, 20, 20);
triangle(550, 70, 550, 60, 540, 70);
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (oniseeds == 0) {
fill(150);
ellipse(549, 54, 50, 50);
fill(130);
triangle(540, 60, 530, 50, 533, 48);
triangle(533, 52, 532, 45, 530, 46);
triangle(532, 52, 527, 50, 529, 48);
fill(115);
ellipse(540, 60, 20, 20);
triangle(550, 70, 550, 60, 540, 70);
fill(100);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//potato smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(216, 202, 181);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
//tomato smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(245, 44, 58);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
else if (inventorynum == inventory[4]) {
if (potseeds >= 1) {
//potato
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(216, 202, 181);
ellipse(538, 58, 16, 16);
ellipse(544, 64, 14, 14);
fill(0,0,0,0);
stroke(196, 172, 160);
strokeWeight(1);
ellipse(538, 62, 3, 3);
ellipse(533, 53, 2, 2);
ellipse(547, 67, 1, 2);
ellipse(542, 54, 1, 1);
ellipse(546, 60, 2, 2);
noStroke();
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (potseeds == 0) {
fill(150);
ellipse(549, 54, 50, 50);
fill(130);
ellipse(538, 58, 16, 16);
ellipse(544, 64, 14, 14);
fill(0, 0, 0, 0);
stroke(100);
strokeWeight(1);
ellipse(538, 62, 3, 3);
ellipse(533, 53, 2, 2);
ellipse(547, 67, 1, 2);
ellipse(542, 54, 1, 1);
ellipse(546, 60, 2, 2);
noStroke();
fill(100);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//tomato smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(245, 44, 58);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
//turnip smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(218, 242, 221);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
else if (inventorynum == inventory[5]) {
if (tomseeds >= 1) {
//tomato
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(245, 44, 58);
ellipse(538, 63, 15, 15);
ellipse(550, 60, 15, 15);
ellipse(544, 62, 20, 20);
fill(52, 188, 34);
quad(536, 54, 537, 52, 547, 55, 546, 57);
quad(548, 52, 547, 50, 537, 57, 538, 59);
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (tomseeds == 0) {
fill(150);
ellipse(549, 54, 50, 50);
fill(130);
ellipse(538, 63, 15, 15);
ellipse(550, 60, 15, 15);
ellipse(544, 62, 20, 20);
fill(100);
quad(536, 54, 537, 52, 547, 55, 546, 57);
quad(548, 52, 547, 50, 537, 57, 538, 59);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//turnip smol
fill(209, 183, 143);
ellipse(479, 23, 14, 14);
fill(218, 242, 221);
ellipse(478, 24, 4, 4);
fill(167, 94, 79);
ellipse(481, 18, 7, 7);
fill(209, 183, 143);
ellipse(482, 16, 6, 5);
ellipse(482.5, 15, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 14.5, 4, 3);
// ellipse(480, 60, 30, 30);
//watering can
fill(35, 55, 103);
quad(473, 66.5, 485, 70, 488, 59, 478, 56);
triangle(470, 57, 477, 62, 479, 59);
fill(0, 0, 0, 0);
stroke(35, 55, 103);
strokeWeight(1);
ellipse(487, 64, 5, 5);
fill(209, 239, 255);
ellipse(470, 57, 4, 4);
stroke(118, 138, 188);
line(484, 58, 482.5, 69);
noStroke();
}
else if (inventorynum == inventory[6]) {
//turnip seeds
if (turseeds >= 1) {
fill(209, 183, 143);
ellipse(549, 54, 50, 50);
fill(52, 188, 34);
triangle(543, 63, 530, 55, 535, 50);
triangle(535, 55, 534, 48, 531, 49);
triangle(536, 56, 527, 55, 528, 52);
fill(162, 13, 65);
ellipse(543, 63, 20, 20);
fill(218, 242, 221);
ellipse(545, 65, 15, 15);
triangle(552, 72, 552, 62, 542, 72);
fill(167, 94, 79);
ellipse(555, 38, 30, 25);
fill(209, 183, 143);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(185, 145, 114);
ellipse(558, 26, 17, 10);
}
else if (turseeds == 0) {
fill(150);
ellipse(549, 54, 50, 50);
fill(130);
triangle(543, 63, 530, 55, 535, 50);
triangle(535, 55, 534, 48, 531, 49);
triangle(536, 56, 527, 55, 528, 52);
fill(100);
ellipse(543, 63, 20, 20);
fill(130);
ellipse(545, 65, 15, 15);
triangle(552, 72, 552, 62, 542, 72);
fill(100);
ellipse(555, 38, 30, 25);
fill(150);
ellipse(556, 35, 20, 15);
quad(546, 35, 566, 37, 569, 29, 550, 20);
ellipse(558, 28, 25, 20);
fill(130);
ellipse(558, 26, 17, 10);
}
//watering can
fill(35, 55, 103);
quad(473, 26.5, 485, 30, 488, 19, 478, 16);
triangle(470, 17, 477, 22, 479, 19);
fill(0, 0, 0, 0);
stroke(35, 55, 103);
strokeWeight(1);
ellipse(487, 24, 5, 5);
fill(209, 239, 255);
ellipse(470, 17, 4, 4);
stroke(118, 138, 188);
line(484, 18, 482.5, 29);
noStroke();
//carrot smol
fill(209, 183, 143);
ellipse(479, 63, 14, 14);
fill(252, 142, 5);
ellipse(478, 64, 4, 4);
fill(167, 94, 79);
ellipse(481, 58, 7, 7);
fill(209, 183, 143);
ellipse(482, 56, 6, 5);
ellipse(482.5, 55, 7, 5);
fill(185, 145, 114);
ellipse(482.5, 54.5, 4, 3);
}
}
//drawMoney show the player's current balance
void drawMoney () {
txt = createFont("Gulim", 22);
textFont(txt, 22);
fill(209, 239, 255);
text ("$"+ counter, 518, 120);
}
}class Menu {
//Shop UI accessed from the shed at the top of the menu. All functions within this class only display if the player is within range of the shed
//drawMenu - draws the semitransparent rectangle that is the background of the shop ui
void drawMenu() {
if (charaPos.x >= 50 && charaPos.x <= 130 && charaPos.y <= 55) {
fill(209, 239, 255, 140);
rect(50, 25, 500, 350, 30);
}
}
//drawUpdate - turns the button the player is currently hovering over into an opaque blue, visual aid in seeing what you're hovering over
void drawUpdate() {
noStroke();
if (charaPos.x >= 50 && charaPos.x <= 130 && charaPos.y <= 55) {
fill(209, 239, 255);
if (mouseX >= buttonx && mouseX <= buttonx+110 && mouseY >= buttony && mouseY <= buttony+120) {
rect(buttonx, buttony, 110, 120, 20);
} else if (mouseX >= buttonx+buttons && mouseX <= buttonx+buttons+110 && mouseY >= buttony && mouseY <= buttony+120) {
rect(buttonx+buttons, buttony, 110, 120, 20);
} else if (mouseX >= buttonx+(buttons*2) && mouseX <= buttonx+(buttons*2)+110 && mouseY >= buttony && mouseY <= buttony+120) {
rect(buttonx+(buttons*2), buttony, 110, 120, 20);
}
//row2
else if (mouseX >= buttonx && mouseX <= buttonx+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130) {
rect(buttonx, buttony+buttons+10, 110, 120, 20);
} else if (mouseX >= buttonx+buttons && mouseX <= buttonx+buttons+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130) {
rect(buttonx+buttons, buttony+buttons+10, 110, 120, 20);
} else if (mouseX >= buttonx+(buttons*2) && mouseX <= buttonx+(buttons*2)+110 && mouseY >= buttony+buttons+10 && mouseY <= buttony+buttons+130) {
rect(buttonx+(buttons*2), buttony+buttons+10, 110, 120, 20);
}
}
}
//drawButtons - semitransparent rectangles that are the buttons of the menu. Includes the visual of the seeds, buying and selling price, and a crosshair to show where the mouse currently is.
void drawButtons() {
int buttons = 150;
int buttonx = 90;
int buttony = 60;
if (charaPos.x >= 50 && charaPos.x <= 130 && charaPos.y <= 55) {
for (buttonx = 90; buttonx < 500; buttonx = buttonx + buttons) {
for (buttony = 60; buttony < 300; buttony = buttony + (buttons+10)) {
fill(209, 239, 255, 140);
rect(buttonx, buttony, 110, 120, 20);
//text
txt = createFont("Gulim", 16);
textFont(txt, 16);
fill(118, 138, 188);
text ("BUY: SELL:", buttonx+5, buttony+95);
//seeds
fill(209, 183, 143);
ellipse(buttonx+51, buttony+54, 50, 50);
fill(167, 94, 79);
ellipse(buttonx+57, buttony+38, 30, 25);
fill(209, 183, 143);
ellipse(buttonx+58, buttony+35, 20, 15);
ellipse(buttonx+60, buttony+28, 25, 20);
fill(185, 145, 114);
ellipse(buttonx+60, buttony+26, 17, 10);
}
//prices - while loops as each column uses same buy/sell prices (bc im lazy)
//int buttons = 150;
// int buttonx = 90;
// int buttony = 60;
int texts = 160;
int textx = 97;
int texty = 157;
while (texty <= 320) {
stroke(118, 138, 188);
strokeWeight(1);
fill(0, 0, 0, 0);
//40
ellipse(textx+5, texty+5, 10, 8);
ellipse(textx+5, texty+13, 10, 8);
ellipse(textx+63, texty+5, 10, 8);
ellipse(textx+63, texty+13, 10, 8);
line(textx+5, texty-1, textx+5, texty+20);
line(textx+63, texty-1, textx+63, texty+20);
//block
fill(189, 234, 219);
noStroke();
rect(textx, texty+10, 4, 4);
rect(textx+58, texty+10, 4, 4);
rect(textx+7, texty+5, 4, 4);
rect(textx+65, texty+5, 4, 4);
//buy
strokeWeight(1.2);
stroke(118, 138, 188);
fill(0, 0, 0, 0);
line(textx+15, texty+1, textx+15, texty+10);
line(textx+15, texty+10, textx+22, texty+10);
line(textx+22, texty+1, textx+22, texty+18);
ellipse(textx+30, texty+10, 10, 18);
//sell
line(textx+72, texty+2, textx+81, texty+2);
line(textx+81, texty+2, textx+75, texty+8);
ellipse(textx+77.5, texty+13, 10, 10);
//block
fill(189, 234, 219);
noStroke();
rect(textx+72, texty+11, 4, 4);
//ea
stroke(118, 138, 188);
fill(0, 0, 0, 0);
strokeWeight(0.5);
ellipse(textx+86, texty+4.5, 6, 6);
line(textx+83, texty+4.5, textx+89, texty+4.5);
ellipse(textx+93, texty+4.5, 6, 6);
line(textx+96, texty+1, textx+96, texty+7);
//50
strokeWeight(1);
ellipse(textx+155, texty+5, 10, 8);
ellipse(textx+155, texty+13, 10, 8);
ellipse(textx+213, texty+5, 10, 8);
ellipse(textx+213, texty+13, 10, 8);
line(textx+155, texty-1, textx+155, texty+20);
line(textx+213, texty-1, textx+213, texty+20);
//block
fill(189, 234, 219);
noStroke();
rect(textx+150, texty+10, 4, 4);
rect(textx+208, texty+10, 4, 4);
rect(textx+157, texty+5, 4, 4);
rect(textx+215, texty+5, 4, 4);
//buy
strokeWeight(1.2);
stroke(118, 138, 188);
fill(0, 0, 0, 0);
line(textx+162, texty+1, textx+172, texty+1);
line(textx+162, texty+1, textx+162, texty+11);
ellipse(textx+167, texty+13, 10, 10);
ellipse(textx+180, texty+10, 10, 18);
//sell
line(textx+222, texty+1, textx+222, texty+10);
line(textx+222, texty+10, textx+229, texty+10);
line(textx+229, texty+1, textx+229, texty+18);
//block
fill(189, 234, 219);
noStroke();
rect(textx+162, texty+12, 4, 4);
//ea
stroke(118, 138, 188);
fill(0, 0, 0, 0);
strokeWeight(0.5);
ellipse(textx+236, texty+4.5, 6, 6);
line(textx+233, texty+4.5, textx+239, texty+4.5);
ellipse(textx+243, texty+4.5, 6, 6);
line(textx+246, texty+1, textx+246, texty+7);
//70
strokeWeight(1);
ellipse(textx+305, texty+5, 10, 8);
ellipse(textx+305, texty+13, 10, 8);
ellipse(textx+363, texty+5, 10, 8);
ellipse(textx+363, texty+13, 10, 8);
line(textx+305, texty-1, textx+305, texty+20);
line(textx+363, texty-1, textx+363, texty+20);
//block
fill(189, 234, 219);
noStroke();
rect(textx+300, texty+10, 4, 4);
rect(textx+358, texty+10, 4, 4);
rect(textx+307, texty+5, 4, 4);
rect(textx+365, texty+5, 4, 4);
//buy
strokeWeight(1.2);
stroke(118, 138, 188);
fill(0, 0, 0, 0);
line(textx+312, texty+1, textx+322, texty+1);
line(textx+322, texty+1, textx+312, texty+18);
ellipse(textx+330, texty+10, 10, 18);
//sell
strokeWeight(1.2);
stroke(118, 138, 188);
fill(0, 0, 0, 0);
line(textx+371, texty+1, textx+381, texty+1);
line(textx+371, texty+1, textx+371, texty+11);
ellipse(textx+376, texty+13, 10, 10);
//block
fill(189, 234, 219);
noStroke();
rect(textx+371, texty+12, 4, 4);
//block
fill(189, 234, 219);
noStroke();
rect(textx+72, texty+11, 4, 4);
//ea
stroke(118, 138, 188);
fill(0, 0, 0, 0);
strokeWeight(0.5);
ellipse(textx+386, texty+4.5, 6, 6);
line(textx+383, texty+4.5, textx+389, texty+4.5);
ellipse(textx+393, texty+4.5, 6, 6);
line(textx+396, texty+1, textx+396, texty+7);
texty = texty + texts;
//put this stuff in hover thing too, so colour updates
//grass (189, 234, 219);
//dirt (216, 231, 219);
noStroke();
}
//vegetable labels for menu
//----------------------------------------------------------carrot
noStroke();
fill(252, 142, 5);
ellipse(130, 115, 12, 12);
ellipse(138.5, 128, 4, 4);
quad(126, 120, 136, 114, 140, 126, 137, 129);
fill(52, 188, 34);
triangle(120, 112, 121, 109, 129, 112);
triangle(134, 105, 131, 103, 129, 112);
triangle(123, 105, 125, 104, 129, 112);
//----------------------------------------------------------corn
fill(162, 233, 138);//green
quad(141, 286, 144, 289, 140, 292, 137, 288);
ellipse(136, 283, 12, 12);
fill(252, 240, 105); //yellow
ellipse(126, 270, 4, 4);
ellipse(130, 272, 4, 4);
ellipse(126, 274, 4, 4);
ellipse(133, 275, 4, 4);
ellipse(130, 277, 4, 4);
ellipse(127, 278, 4, 4);
ellipse(136, 278, 4, 4);
ellipse(133, 280, 4, 4);
ellipse(129.5, 282, 4, 4);
ellipse(139, 281, 4, 4);
ellipse(136, 283, 4, 4);
ellipse(132, 285, 4, 4);
ellipse(140, 285, 4, 4);
ellipse(136, 287, 4, 4);
fill(162, 233, 138);//green
quad(138, 290, 140, 286, 125, 280, 121, 281);
quad(143, 288, 139, 286, 135, 274, 137, 269);
//--------------------------------------------------------------------------------onion
fill(52, 188, 34);
triangle(283, 122, 273, 112, 276, 110);
triangle(276, 114, 275, 107, 273, 108);
triangle(275, 114, 270, 112, 272, 110);
fill(162, 13, 65);
ellipse(283, 122, 20, 20);
triangle(293, 132, 293, 122, 283, 132);
//---------------------------------------------------------------potatoooooooooooooooooo
fill(216, 202, 181);
ellipse(281, 280, 16, 16);
ellipse(287, 286, 14, 14);
fill(0,0,0,0);
stroke(196, 172, 160);
strokeWeight(1);
ellipse(281, 284, 3, 3);
ellipse(276, 275, 2, 2);
ellipse(290, 289, 1, 2);
ellipse(285, 276, 1, 1);
ellipse(289, 282, 2, 2);
noStroke();
//---------------------------------------------------------------tomatoooooooooooo
fill(245, 44, 58);
ellipse(431, 125, 15, 15);
ellipse(443, 122, 15, 15);
ellipse(437, 124, 20, 20);
fill(52, 188, 34);
quad(429, 116, 430, 114, 440, 117, 439, 119);
quad(439, 114, 440, 112, 430, 119, 431, 121);
//------------------------------------------------------------------turnpppppppppppppppppppppppppppp
fill(52, 188, 34);
triangle(436, 285, 423, 277, 428, 272);
triangle(428, 277, 427, 270, 424, 271);
triangle(429, 278, 420, 277, 421, 274);
fill(162, 13, 65);
ellipse(436, 285, 20, 20);
fill(218, 242, 221);
ellipse(438, 287, 15, 15);
triangle(445, 294, 445, 284, 435, 294);
//mouse crosshair for menu nav
fill(255);
rect(mouseX-1, mouseY-2, 2, 6);
rect(mouseX-3, mouseY, 6, 2);
}
}
}
}class Plant {
//The plants, main functionality of game
//All within one function because i like to suffer apparently
//responsible for all plants and their cycles
int px = 90;
int py = 110;
int pspace = 22;
//drawPlants:
//Dictates whether or not the player's position is correct in relation to what seed they're about to plant/if they're going to water a plant
//Dictates that only x plant can go in x field.
//Dictates that a plant can be watered only after its been planted and that seeds cannot be planted if a plant is already there
//Visually shows the stage in its cycle each plant is (based on voidd Timer)
//Allows the player to plant seeds if they have them, and does not allow them to plant them if they do not have them
//Adds money to player's balance when they pick a plant and remove the plant state, allowing the player to plant more seeds
//uses for loops to visually show the plants
void drawPlants() {
if (keyCode == 'X' && charaPos.x >= 150 && charaPos.x <= 210 && charaPos.y >= 100 && charaPos.y <= 160) {
if (is1planted == false) {
if (inventorynum == inventory[1] && carseeds >= 1) {
is1planted = true;
cyclenum1 = 0;
carseeds = carseeds - 1;
}
}
else if (is1planted == true) {
if (cyclenum1 >= 3) {
is1watered = false;
is1planted = false;
counter = counter + (3*18);
}
if (inventorynum == inventory[0] && cyclenum1 <= 3) {
is1watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
if (keyCode == 'X' && charaPos.x >= 150 && charaPos.x <= 210 && charaPos.y >= 180 && charaPos.y <= 240) {
if (is2planted == false) {
if (inventorynum == inventory[2] && corseeds >= 1) {
cyclenum2 = 0;
is2planted = true;
corseeds = corseeds - 1;
}
}
else if (is2planted == true) {
if (cyclenum2 >= 3) {
is2watered = false;
is2planted = false;
counter = counter + (3*18);
}
if (inventorynum == inventory[0]) {
is2watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
if (keyCode == 'X' && charaPos.x >= 150 && charaPos.x <= 210 && charaPos.y >= 260 && charaPos.y <= 320) {
if (is3planted == false) {
if (inventorynum == inventory[3] && oniseeds >= 1) {
cyclenum3 = 0;
is3planted = true;
oniseeds = oniseeds - 1;
}
}
else if (is3planted == true) {
if (cyclenum3 >= 3) {
is3watered = false;
is3planted = false;
counter = counter + (4*18);
}
if (inventorynum == inventory[0]) {
is3watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
if (keyCode == 'X' && charaPos.x >= 390 && charaPos.x <= 450 && charaPos.y >= 100 && charaPos.y <= 160) {
if (is4planted == false) {
if (inventorynum == inventory[4] && potseeds >= 1) {
cyclenum4 = 0;
is4planted = true;
potseeds = potseeds - 1;
}
}
else if (is4planted == true) {
if (cyclenum4 >= 3) {
is4watered = false;
is4planted = false;
counter = counter + (4*18);
}
if (inventorynum == inventory[0]) {
is4watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
if (keyCode == 'X' && charaPos.x >= 390 && charaPos.x <= 450 && charaPos.y >= 180 && charaPos.y <= 240) {
if (is5planted == false) {
if (inventorynum == inventory[5] && tomseeds >= 1) {
cyclenum5 = 0;
is5planted = true;
tomseeds = tomseeds - 1;
}
}
else if (is5planted == true) {
if (cyclenum5 >= 3) {
is5watered = false;
is5planted = false;
counter = counter + (5*18);
}
if (inventorynum == inventory[0]) {
is5watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
if (keyCode == 'X' && charaPos.x >= 390 && charaPos.x <= 450 && charaPos.y >= 260 && charaPos.y <= 320) {
if (is6planted == false) {
if (inventorynum == inventory[6] && turseeds >= 1) {
cyclenum6 = 0;
is6planted = true;
turseeds = turseeds - 1;
}
}
else if (is6planted == true) {
if (cyclenum6 >= 3) {
is6watered = false;
is6planted = false;
counter = counter + (5*18);
}
if (inventorynum == inventory[0]) {
is6watered = true;
}
else if (inventorynum >= 1) {
carseeds = carseeds - 0;
corseeds = corseeds - 0;
oniseeds = oniseeds - 0;
potseeds = potseeds - 0;
tomseeds = tomseeds - 0;
turseeds = turseeds - 0;
}
}
}
//dont forget to put cycles here
//---------------------------------------------------------------------------------------------carrot
if (is1planted == true) {
if (cyclenum1 == 0) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum1 == 1) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum1 == 2) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
}
else if (cyclenum1 == 3) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(252, 142, 5);
stroke(206, 133, 60);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(252, 142, 5);
stroke(206, 133, 60);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
}
}
//---------------------------------------------------------------------------------------------potato
if (is4planted == true) {
if (cyclenum4 == 0) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum4 == 1) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum4 == 2) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
}
else if (cyclenum4 == 3) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+9, 9, 3);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+3, 9, 3);
ellipse(px+5, py, 9, 3);
line(px+10, py+12, px+10, py+3);
fill(255);
stroke(245);
ellipse(px+9, py+9, 2, 2);
ellipse(px+13, py+6, 2, 2);
ellipse(px+9, py+3, 2, 2);
ellipse(px+13, py, 2, 2);
fill(216, 202, 181);
stroke(196, 172, 160);
quad(px+8, py+12, px+12, py+12, px+14, py+14, px+6, py+14);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 110; py < 170; py = py + pspace) {
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+9, 9, 3);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+3, 9, 3);
ellipse(px+5, py, 9, 3);
line(px+10, py+12, px+10, py+3);
fill(255);
stroke(245);
ellipse(px+9, py+9, 2, 2);
ellipse(px+13, py+6, 2, 2);
ellipse(px+9, py+3, 2, 2);
ellipse(px+13, py, 2, 2);
fill(216, 202, 181);
stroke(196, 172, 160);
quad(px+8, py+12, px+12, py+12, px+14, py+14, px+6, py+14);
}
}
}
}
//---------------------------------------------------------------------------------------------corn
if (is2planted == true) {
if (cyclenum2 == 0) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum2 == 1) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum2 == 2) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
}
else if (cyclenum2 == 3) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
ellipse(px+10, py+4, 6, 10);
stroke(209, 158, 63);
fill(252, 240, 105);
ellipse(px+10, py+2, 4, 8);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
ellipse(px+10, py+4, 6, 10);
stroke(209, 158, 63);
fill(252, 240, 105);
ellipse(px+10, py+2, 4, 8);
}
}
}
}
//---------------------------------------------------------------------------------------------tomato
if (is5planted == true) {
if (cyclenum5 == 0) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum5 == 1) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum5 == 2) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
}
}
}
else if (cyclenum5 == 3) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
stroke(165, 63, 67);
fill(245, 44, 58);
ellipse(px+10, py+8, 7, 7);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 190; py < 250; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+15, py+12, 9, 3);
ellipse(px+5, py+9, 9, 3);
ellipse(px+15, py+6, 9, 3);
ellipse(px+5, py+3, 9, 3);
line(px+10, py+15, px+10, py+6);
stroke(165, 63, 67);
fill(245, 44, 58);
ellipse(px+10, py+8, 7, 7);
}
}
}
}
//---------------------------------------------------------------------------------------------onion
if (is3planted == true) {
if (cyclenum3 == 0){
for (px = 90; px < 150; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum3 == 1) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum3 == 2) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
}
else if (cyclenum3 == 3) {
for (px = 90; px < 150; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(162, 13, 65);
stroke(147, 52, 77);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
for (px = 210; px < 270; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(162, 13, 65);
stroke(147, 52, 77);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
}
}
//---------------------------------------------------------------------------------------------turnip
if (is6planted == true) {
if (cyclenum6 == 0) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(98, 68, 60);
fill(188, 147, 120);
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
ellipse(px+5, py+3, 3, 3);
ellipse(px+15, py+5, 3, 3);
ellipse(px+9, py+10, 3, 3);
}
}
}
else if (cyclenum6 == 1) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
ellipse(px+5, py+6, 9, 3);
ellipse(px+15, py+6, 9, 3);
line(px+10, py+10, px+10, py+6);
}
}
}
else if (cyclenum6 == 2) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+6, px+6, py+3, px+10, py+10);
triangle(px+15, py+6, px+14, py+3, px+10, py+10);
triangle(px+12, py+2, px+8, py+2, px+10, py+10);
}
}
}
else if (cyclenum6 == 3) {
for (px = 330; px < 390; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(218, 242, 221);
stroke(147, 52, 77);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
for (px = 450; px < 510; px = px + pspace) {
for (py = 270; py < 330; py = py + pspace) {
strokeWeight(1);
stroke(38, 134, 72);
fill(99, 198, 72);
triangle(px+5, py+4, px+6, py+1, px+10, py+8);
triangle(px+15, py+4, px+14, py+1, px+10, py+8);
triangle(px+12, py, px+8, py, px+10, py+8);
fill(218, 242, 221);
stroke(147, 52, 77);
quad(px+8, py+8, px+12, py+8, px+14, py+10, px+6, py+10);
}
}
}
}
noStroke();
}
//void Timer
//Starts moving a block across the screen once a plant has been watered
//increments the stage in the cycle of a plant based on the blocks x position on the screen
//resets the block position once a plant reaches the end of its cycle
//because using actual time functions was too complicated
void Timers() {
if(is1watered == true) {
fill(0);
rect(time1x, 0, 4, 4);
time1x = time1x + 1;
if (time1x == 200) {
cyclenum1 = cyclenum1 + 1;
}
else if (time1x == 400) {
cyclenum1 = cyclenum1 + 1;
}
else if (time1x == 600) {
cyclenum1 = cyclenum1 + 1;
}
else if (cyclenum1 == 3) {
is1watered = false;
time1x = 20;
}
}
if(is2watered == true) {
fill(0);
rect(time2x, 30, 4, 4);
time2x = time2x + 1;
if (time2x == 200) {
cyclenum2 = cyclenum2 + 1;
}
else if (time2x == 400) {
cyclenum2 = cyclenum2 + 1;
}
else if (time2x == 600) {
cyclenum2 = cyclenum2 + 1;
}
else if (cyclenum2 == 3) {
is2watered = false;
time2x = 20;
}
}
if(is3watered == true) {
fill(0);
rect(time3x, 40, 4, 4);
time3x = time3x + 1;
if (time3x == 200) {
cyclenum3 = cyclenum3 + 1;
}
else if (time3x == 400) {
cyclenum3 = cyclenum3 + 1;
}
else if (time3x == 600) {
cyclenum3 = cyclenum3 + 1;
}
else if (cyclenum3 == 3) {
is3watered = false;
time3x = 20;
}
}
if(is4watered == true) {
fill(0);
rect(time4x, 50, 4, 4);
time4x = time4x + 1;
if (time4x == 200) {
cyclenum4 = cyclenum4 + 1;
}
else if (time4x == 400) {
cyclenum4 = cyclenum4 + 1;
}
else if (time4x == 600) {
cyclenum4 = cyclenum4 + 1;
}
else if (cyclenum4 == 3) {
is4watered = false;
time4x = 20;
}
}
if(is5watered == true) {
fill(0);
rect(time5x, 60, 4, 4);
time5x = time5x + 1;
if (time5x == 200) {
cyclenum5 = cyclenum5 + 1;
}
else if (time5x == 400) {
cyclenum5 = cyclenum5 + 1;
}
else if (time5x == 600) {
cyclenum5 = cyclenum5 + 1;
}
else if (cyclenum5 == 3) {
is5watered = false;
time5x = 20;
}
}
if(is6watered == true) {
fill(0);
rect(time6x, 70, 4, 4);
time6x = time6x + 1;
if (time6x == 200) {
cyclenum6 = cyclenum6 + 1;
}
else if (time6x == 400) {
cyclenum6 = cyclenum6 + 1;
}
else if (time6x == 600) {
cyclenum6 = cyclenum6 + 1;
}
else if (cyclenum6 == 3) {
is6watered = false;
time6x = 20;
}
}
}
}class Shed {
//visual representation of the shed, where the player access the shop
void drawShed() {
fill(213, 195, 53);
rect(40, 0, 100, 62);
fill(153, 129, 0);
triangle(35, 0, 60, 0, 35, 15);
triangle(120, 0, 145, 0, 145, 15);
fill(137, 88, 14);
rect(75, 25, 30, 37);
rect(50, 20, 16, 16);
rect(115, 20, 16, 16);
fill(213, 195, 53);
ellipse(100, 45, 3, 3);
fill(209, 239, 255);
rect(52, 22, 5, 5);
rect(59, 22, 5, 5);
rect(52, 29, 5, 5);
rect(59, 29, 5, 5);
rect(117, 22, 5, 5);
rect(124, 22, 5, 5);
rect(117, 29, 5, 5);
rect(124, 29, 5, 5);
}
}