xxxxxxxxxx
168
function setup()
{
createCanvas(640, 640);
mousePressed();
}
function mousePressed()
{
background("pink");
noFill();
strokeWeight(3);
fill("green");
stroke("pink");
rect(20,140,600,480, 100);
let numObstacles = random(10,30);
let xObstacles = [random(60,580)];
let yObstacles = [random(160,580)];
let xDestination = random(60,580);
let yDestination = random(160,580);
noStroke();
for(let i=1; i<=numObstacles; i++)
{
append(xObstacles, random(60,580));
append(yObstacles, random(160,580));
while(abs(xObstacles[i]-xDestination)<=100 && abs(yObstacles[i]-yDestination)<=100)
{
xObstacles[i]=random(60,580);
yObstacles[i]=random(160,580);
} //makes sure no obstacles are close to the destination
if(random(0,8) >= 2)
{
fill("gray");
circle(xObstacles[i]+10, yObstacles[i]+10, random(0,50));
}
else
{
if(random(0,4)<1)
fill("darkGreen");
else
fill("pink");
let xStartBezier = xObstacles[i]-random(10,40);
let yStartBezier = yObstacles[i]-random(10,40);
curveTightness(0.25);
beginShape();
curveVertex(xStartBezier, yStartBezier);
curveVertex(xObstacles[i]-random(10,40), yObstacles[i]-random(-5,5));
curveVertex(xObstacles[i]-random(10,40), yObstacles[i]-random(-40,-10));
curveVertex(xObstacles[i]-random(-5,5), yObstacles[i]-random(-40,-10));
curveVertex(xObstacles[i]-random(-40,-10), yObstacles[i]-random(-40,-10));
curveVertex(xObstacles[i]-random(-40,-10), yObstacles[i]-random(-5,-5));
curveVertex(xObstacles[i]-random(-40,-10), yObstacles[i]-random(10,40));
curveVertex(xObstacles[i]-random(-5,5), yObstacles[i]-random(10,40));
curveVertex(xObstacles[i]-random(10,40), yObstacles[i]-random(10,40));
curveVertex(xStartBezier, yStartBezier);
endShape(); //rocks and greenery, perhaps a for loop would be better
}
}
stroke("pink");
strokeWeight(3);
noFill();
curveTightness(-1);
beginShape();
let sideChoice = random(4);
let xStart, yStart;
if(sideChoice<=1)
{
xStart = random(60,580);
yStart = 140;
}
else if(sideChoice<=2)
{
xStart=20;
yStart=random(120,580);
}
else if(sideChoice<=3)
{
xStart=random(60,580);
yStart=620;
}
else
{
xStart=620
yStart=random(120,580);
}
curveVertex(xStart, yStart);
curveVertex(xStart, yStart);
curveVertex(random(100,540),random(140,540));
curveVertex(random(100,540),random(140,540));
//curveVertex(random(min(xStart,xDestination)+30, max(xStart,xDestination))-30, random(min(yStart,yDestination)+30, max(yStart,yDestination))-30);
curveVertex(xDestination, yDestination);
curveVertex(xDestination, yDestination);
endShape();
noStroke();
fill("green");
circle(xDestination, yDestination, 60);
stroke("pink");
line(xDestination - 10, yDestination - 10, xDestination + 10, yDestination + 10);
line(xDestination - 10, yDestination + 10, xDestination + 10, yDestination - 10);
fill("pink");
rect(20,20,600,120);
fill("royalBlue");
textFont("Cursive");
textAlign(CENTER);
textSize(20);
text(int(random(10,100)) + " of ur friends & their friends r having a happy time here", 320,50);
text("& we love u & miss being close to u & r waiting to listen to", 320,80);
text("happy music until u find us & have fun with us again :~)", 320,110);
fill("red");
noStroke();
let i=20;
let j=35;
beginShape();
vertex(i+20, j+15);
bezierVertex(i+10, j, i-5, j+20, i+20, j+35);
vertex(i+20, j+15);
bezierVertex(i+30, j, i+45, j+20, i+20, j+35);
endShape();
i=20;
j=70;
beginShape();
vertex(i+20, j+15);
bezierVertex(i+10, j, i-5, j+20, i+20, j+35);
vertex(i+20, j+15);
bezierVertex(i+30, j, i+45, j+20, i+20, j+35);
endShape();
i=580;
j=35;
beginShape();
vertex(i+20, j+15);
bezierVertex(i+10, j, i-5, j+20, i+20, j+35);
vertex(i+20, j+15);
bezierVertex(i+30, j, i+45, j+20, i+20, j+35);
endShape();
i=580;
j=70;
beginShape();
vertex(i+20, j+15);
bezierVertex(i+10, j, i-5, j+20, i+20, j+35);
vertex(i+20, j+15);
bezierVertex(i+30, j, i+45, j+20, i+20, j+35);
endShape();
}