I'm making a 2 player game so if u press F2 it creates player two in your world. I try to used getkey and iskeydown but both doesnt work getkey simply does nothing while iskeydown makes too many player 2's
if (Greenfoot.isKeyDown("F2") && getObjects(Player2.class).isEmpty())