I'm having trouble specifying an if statement for when the mouse is being held down.
My attempts are as follows.
//Attempt 1 MouseInfo mi = Greenfoot.getMouseInfo(); if (mi != null) { int btn = mi.getButton(); if(Greenfoot.mousePressed(null) && btn == 1) leftClick = true; //else leftClick = false; if (Greenfoot.mousePressed(null) && btn == 3) rightClick = true; //else rightClick = false; } if (Greenfoot.mouseClicked(null)) { leftClick = false; rightClick = false; } //Attempt 2 if(Greenfoot.mousePressed(null)) { leftClick = true; } if (leftClick && Greenfoot.mouseClicked(null)) { leftClick = false; } //Attempt 3 if(Greenfoot.mousePressed(null) && !Greenfoot.mouseClicked(null)) { leftClick = true; } else { leftClick = false; }