function setup() {
createCanvas(windowWidth, windowHeight);
yCoordinatBold = 100;
ySpeedBold = 6;
windowWidth=650;
GreenBallHit = false
}
let img;
function preload(){
img = createImg('http://mpsteenstrup.dk/FN_maal/FN10.jpg','');
img.hide();
}
function draw() {
background(91,146,229);
image(img,mouseX,mouseY,80,80)
// Græsplænen
fill(100,200,80);
rect(0,750,1500,100);
var x=400;
// Cirkel, rød når ramt af mus
fill(0,200,0); // grøn
if(mouseX>300 && mouseX<500 && mouseY>yCoordinatBold-100 && mouseY<yCoordinatBold+100) {
fill(200,0,0) // rød hvid ramt af mus
}
ellipse(x,yCoordinatBold,200,200);
yCoordinatBold += ySpeedBold;
// Skift retning på cirkel , hvis den rtammer grænserbne
if (yCoordinatBold>windowWidth || yCoordinatBold<0){
ySpeedBold = -ySpeedBold;
}
//forhindring
fill(200,0,0);
rect(800,600,160,150);
//Udsagn 1
fill(0,0,0)
textSize(20,30)
text("Blive diskrimineret",800,670)
//Udsagn 1
fill(0,0,0)
textSize(20,30)
text("pga din hudfarve",800,690)
text("hej"x,yCoordinatBold+30);
}
// function mousePressed (){
// if(mouseX>300 && mouseX<500 && mouseY>300 && mouseY<500){}
//
//}
Comments