so i have a single player game right now, but i want to make it a multiplayer game if the users wants. So i want an actor to spawn if you press the number '2' on your keyboard once.
How can i do this? Thanks in advance.
// instance field
private boolean twoSelected; // default value is 'false'
// in act method
if ( ! twoSelected && Greenfoot.isKeyDown("2") )
{
twoSelected = true;
// spawn second player here
}