Mouse inputs

    • Watch FunProgramming [Video 20]

    • Here’s a program I wrote:

void setup()

{

size(400,400);

background(0);

stroke(255);

}

void draw()

{

if (mousePressed == true)

{

draw_flower();

}

}

void draw_flower()

{

point(mouseX,mouseY);

strokeWeight(random(10));

}

    • Change the program so it draws colorful flowers (or lightening bolts or gears or minecraft blocks.. what ever you like) when the mouse is pressed - like this ↑

    • Show a mentor, mark the board and get a prize.