int x;
int y;
int wx;
int wy;
int s = 0;
PImage sunf;
PImage bee;
void setup(){
size(1920,1080);
x = (int)random(200,1700);
y = (int)random(200, 800);
bee = loadImage(“bee.png”);
sunf = loadImage(“sunf.jpg”);
}
void draw(){
wx = x + 50;
wy = y + 20;
background(255);
image(sunf,x,y);
image(bee, mouseX, mouseY);
if(wx == mouseX && wx == mouseY){
x = (int)random(200,1700);
y = (int)random(200, 800);
s++;
textSize(32);
fill(0);
textAlign(RIGHT);
text(s, 1920,0);
}
}
I am trying to make a basic game in my digital technology class. I want it so when the mouse is over the sunflower(sunf) it moves to a new random location and adds 1 to a score counter in the top right and the is a bee following the mouse. when I run my code the sunflower shows on and the bee follows the mouse but when the mouse is over the sunflower nothing happens.