Search and Find Game Help
in
Programming Questions
•
2 years ago
I am creating a traditional search and find game (similar to where's waldo and classic adventure style PC games) in which a scene is generated with a list of items to find within it. All of that is done and coded, my problem is that I don't know how to make it so that when you click on one of the listed objects (which are PNG files) it disappears from the scene and the object name is removed from the list. (could also be done by drawing a rectangle the same color as the list over top of the object name). Any help is greatly appreciated! Here is a picture of the program and the source code:
Source Code:
boolean FOUND = false;
int bH = 100;
int bW = 500;
int bX = 600;
int bY = 590;
PImage s;
PImage s2;
PImage fp;
PImage f;
PImage b;
PImage bu;
PImage h;
PImage m;
PImage pe;
PImage s1rh;
PImage sd;
PImage ba;
PImage ca;
PImage co;
PImage cow;
PImage ha;
PImage tr;
PImage um;
PImage w;
PImage wr;
PImage tre;
PImage tre2;
PImage cl;
PImage sn;
PImage su;
PImage mo;
void setup() {
size(800, 800);
smooth();
noStroke();
s = loadImage("sheep1.png");
noLoop();
f = loadImage("farmer.png");
noLoop();
fp = loadImage("farmer_ps.png");
noLoop();
b = loadImage("boot.png");
noLoop();
bu = loadImage("bucket.png");
noLoop();
h = loadImage("sheep2_hat.png");
noLoop();
s2 = loadImage("sheep2.png");
noLoop();
m = loadImage("marshmallows.png");
noLoop();
pe = loadImage("pencil.png");
noLoop();
s1rh = loadImage("sheep1_rh.png");
noLoop();
sd = loadImage("sword.png");
noLoop();
ba = loadImage("barn.png");
noLoop();
ca = loadImage("cat.png");
noLoop();
co = loadImage("coin.png");
noLoop();
cow = loadImage("cow.png");
noLoop();
ha = loadImage("hay.png");
noLoop();
tr = loadImage("tractor.png");
noLoop();
um = loadImage("umbrella.png");
noLoop();
w = loadImage("well.png");
noLoop();
wr = loadImage("wellr.png");
noLoop();
tre = loadImage("tree.png");
noLoop();
tre2 = loadImage("tree2.png");
noLoop();
cl = loadImage("cloud.png");
noLoop();
sn = loadImage("snake.png");
noLoop();
su = loadImage("sun.png");
noLoop();
mo = loadImage("moon.png");
noLoop();
}
void draw() {
background(0, 232, 266);
fill(0, 232, 25);
stroke(3);
ellipse(700,400,1000,450);
ellipse(0,400,800,400);
noStroke();
rect(0,300,800,500);
fill(4, 80, 22);
rect(0, 300, 800, 2);
fill(118, 46, 0);
//Top Fence
rect(0, 250, 800, 10);
rect(0, 285, 800, 10);
rect(0, 245, 10, 60);
rect(60, 245, 10, 60);
rect(120, 245, 10, 60);
rect(180, 245, 10, 60);
rect(240, 245, 10, 60);
rect(300, 245, 10, 60);
rect(360, 245, 10, 60);
rect(420, 245, 10, 60);
rect(480, 245, 10, 60);
rect(540, 245, 10, 60);
rect(600, 245, 10, 60);
rect(660, 245, 10, 60);
rect(720, 245, 10, 60);
rect(780, 245, 10, 60);
// if we want to tr and work the magnifying glass
//ellipse(mouseX,mouseY, 30, 30);
//translate(0,15);
//fill(95,60,6);
//rect(mouseX,mouseY, 4, 25);
//Objects
image(s, 400, 300);
image(b, 200, 400);
image(h, 600, 590);
if (mousePressed) {
image(s,530,290);}
else {image(ha, 530, 290);}
image(pe, 300, 245);
image(cl,700,60);
image(ba, 570, 50);
image(ca, 350, 500);
image(tr, 0, 450);
image(co, 129, 635);
image(sd, 85, 480);
image(w,300,300);
image(wr,300,300);
image(f, 500, 350);
image(s, 400, 600);
image(fp, 500, 350);
image(bu, 700, 330);
// image(m,100,30);
image(cl,325,10);
image(cl,200,50);
image(su,5,5);
image(mo,31,35);
image(tre,10,100);
image(tre2,650,450);
image(um,95,310);
image(s1rh, 25, 350);
image(cow,740,600);
//Bottom Fence
rect(0, 700, 800, 10);
rect(0, 695, 10, 60);
rect(60, 695, 10, 60);
rect(120, 695, 10, 60);
rect(180, 695, 10, 60);
rect(240, 695, 10, 60);
rect(300, 695, 10, 60);
rect(360, 695, 10, 60);
rect(420, 695, 10, 60);
rect(480, 695, 10, 60);
rect(540, 695, 10, 60);
rect(600, 695, 10, 60);
rect(660, 695, 10, 60);
rect(720, 695, 10, 60);
rect(780, 695, 10, 60);
image(sn,0,690);
//List Container
fill(54, 33, 0);
rect(0,720,800,280);
//List
fill(255, 255, 255);
textSize(14);
textAlign(CENTER, CENTER);
text("Umbrella", 60, 740);
text("Hat", 55, 760);
text("Coin", 57, 780);
text("Bucket", 200, 740);
text("Cow", 200, 760);
text("Pencil", 200, 780);
text("Purple Shirt", 345, 740);
text("Marshmellows", 345, 760);
text("Crescent Moon", 345, 780);
text("Hay", 500, 740);
text("Padlock", 500, 760);
text("Red Hooves", 500, 780);
text("Snake", 655, 740);
text("Sword", 655, 760);
text("Rubber Boot", 655, 780);
}
1