Is there a way to check if the mouse clicked in a certain area?
MouseInfo mouse = Greenfoot.getMouseInfo(); { if(Greenfoot.getButton(1) && getX() > 773 && getX() < 110 && getY() > 42 && getY() < 125) { Greenfoot.setWorld(new world1()); } }
if (mouse != null)
if (Greenfoot.mouseClicked(null)) { MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse.getButton() == 1 && mouse.getX() > 110 && mouse.getX() < 773 && mouse.getY() > 42 && mouse.getY() < 125) { Greenfoot.setWorld(new world1()); } }