Need help with code for school

int x;
int y;
int wx;
int wy;
int s = 0;

PImage sunf;
PImage bee;

void setup(){
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;
image(bee, mouseX, mouseY);
if(wx == mouseX && wx == mouseY){
x = (int)random(200,1700);
y = (int)random(200, 800);
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.



Please format your code so we can read it easily and cut and paste it and run it:

There are a lot of resources here:


The second wx must be wy!

It’s hard to hit a spot exactly with the mouse.

Instead allow for a distance between sunf and mouse of 16 pixel or so

Eg if(dist(wx,wy, mouseX,mouseY) < 16)

Welcome to the forum! Please edit your post and format your code.