I'm trying to get Greenfoot.mousePressed(object) to work.
I want to make it so whenever I click an object in the world, I want to make it move.
Here's my code
I also want to make it so that once I select an object, I can press a key to make it move forward
Here's my code for that, it would work with the code above
if (Greenfoot.mousePressed(WhitePawn.class) == true) { movement(); }
public void movement() { if (Greenfoot.isKeyDown("w") == true) { setLocation(getX(), getY()-75); endTurn(); } }