xxxxxxxxxx
//This exercise refers to this tutorial:
//https://www.openprocessing.org/sketch/961259
//Using the following starter code,
//figure out the boundaries of the rectangular
//flashlight. Then write a conditional "if" statement
//that turns on the yellow light stream only when
//the mouse hovers over the flashlight body.
function setup() {
createCanvas(300,300);
}
//dvdv/
function draw() {
background(0,0,170);
if ((mouseY>123)&&(mouseY<300)&&(mouseX>114)&&(mouseX<184)){
fill (255,255,0);
triangle (100,0,200,0,150,300);
}
fill (70);
rectMode (CENTER);
rect (150,250,70,150);
fill (100);
rect (150,150,70,50);
fill(255,0,0);
rect (150,170,70,10);
}
function mousePressed() {
//tell me what my mouse coordinates are
print("mouseX=", mouseX, "mouseY=", mouseY);
}