Hello,
I want to have a StartScreen. It works, but there is a problem though. When I press the "Run" button and hit enter, the game begins and everything works well. The problem is when I hit the enter key before running the game with the "Run" button. In this case, the game instantly starts when pressing the "Run" button. How can I prevent this?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class StartScreen here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class StartScreen extends World
{
/**
* Constructor for objects of class StartScreen.
*
*/
public StartScreen()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1000, 900, 1);
}
public void act()
{
if(Greenfoot.isKeyDown("enter"))
{
Greenfoot.setWorld(new Hintergrund());
}
}
}