The parameter of the mouseClicked() method requres an actor, how would I use the World as an actor?


1 2 3 4 5 6 7 8 9 10 | public void add() { MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse== null ) return ; int x = mouse.getX(); int y = mouse.getY(); if (Greenfoot.mouseClicked(getWorld())){ getWorld().addObject( new Point(),x,y); } } |