xxxxxxxxxx
82
var x1
var y1
var x2
var y2
var score
var circleX
function setup() {
createCanvas(400, 400);
score = 0;
x1 = 200;
y1 = 200;
}
function draw() {
background(0, 100, 200);
//calculates distance from mouse to "target"
x2 = mouseX;
y2 = mouseY;
circleX = int(dist(x1, y1, x2, y2));
//print(circleX)
//John Deadguy
rectMode(CENTER);
//Head
fill("yellow");
ellipse(x1,y1,12,12);
//arms
rect(x1-13,y1+16,7,20);
rect(x1+13,y1+16,7,20);
//Legs
fill(50, 0, 200);
rect(x1-5, y1+33, 10, 20);
rect(x1+5, y1+33, 10, 20);
//feet
fill(0);
rect(x1-5, y1+40, 10, 5);
rect(x1+5, y1+40, 10, 5);
//Torso
fill(255, 0, 0);
rect(x1, y1+18, 20, 25);
//standart green curser
fill(255, 70);
stroke(0);
//Changes outside ellipse to red if the "target" is in it
if (circleX < 25) {
fill(255, 0, 0, 75);
}
ellipse(mouseX, mouseY, 50, 50);
fill(255, 75);
stroke(0);
ellipse(mouseX, mouseY, 25, 25);
//Changes outside ellipse to red if the "target" is in it
if (circleX < 12) {
fill(255, 75);
ellipse(mouseX, mouseY, 50, 50);
fill(255, 0, 0, 75);
ellipse(mouseX, mouseY, 25, 25);
}
//Makes the rest of the beautiful cursor
ellipse(mouseX, mouseY, 4, 4);
fill(0, 75);
rectMode(CENTER);
rect(mouseX, mouseY, 75, 1);
rect(mouseX, mouseY, 1, 75);
}
function mousePressed(){
if (circleX<5) {
score = score + 1
}
print(score);
}