Simple Drawing Program with 7th grade students

I recently created a simple drawing program with my students which allows them to draw, erase and clear the screen, but can't seem to figure out why, after they've used their RIGHT mouse-click to erase, they can no longer use LEFT click to draw.

Here is the code:

void setup() { size(400, 400); background(255); }

void draw() {

//if mouse is LEFT-clicked, draw! if (mouseButton == LEFT) { line(pmouseX, pmouseY, mouseX, mouseY); }

//If mouse is RIGHT-Clicked, erase! if (mouseButton == RIGHT) { fill(255); noStroke(); ellipse(mouseX, mouseY, 10, 10); }

// If any key is pressed, clear the screen. if (keyPressed) { background(255); } }

Any help would be greatly appreciated!

Thank you.

Tagged:

Answers

Sign In or Register to comment.