int x;
int y;
float circleX;
float circleY;
int points = 0;
void setup(){
size (400, 400);
x = width/2;
y = height/2;
circleX = random(0,400);
circleY = random(0,400);
}
void draw(){
background(0,255,0);
fill(255,0,0);
rect(x, y, 20,20);
fill(0);
ellipse(circleX, circleY, 6,6);
fill(0);
text("Score :" + points, 0,20);
}
void keyPressed() {
if ((keyPressed == true) && (key == CODED)) {
if (keyCode == UP){
y --;
} else if (keyCode == DOWN) {
y ++;
} else if (keyCode == LEFT){
x --;
} else if (keyCode == RIGHT) {
x ++;
}
}
//collision
if((dist(x,y,circleX,circleY) > 400)){
boolean is_player_on_coin(){
return( false );
ellipse(circleX, circleY, 6,6);
points++;
}
}
please check the collision aspect. please tell me what im doing wrong