I don't know what's wrong with me. I've been at this for at least four hours over several days now.
I'm building a game and I need to change the world upon Greenfoot.iskeydown("Enter")
I've followed all the solutions I have found online but I still can't do it.
Yes. I'm using the right name for the world to move to. This seems like such a beginner thing and I still can't do it.
One more question. For when I export my game as a .JAR; how do I choose which world opens immediately upon running?
Thanks in advance to whoever can help.
This is the code for the world that opens upon game load.
public class TitleScreen extends World
{
/**
* Constructor for objects of class TitleScreen.
*
*/
public TitleScreen()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(500, 250, 1);
prepare();
FirstChange();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
YeOldeKecleonShop yeOldeKecleonShop = new YeOldeKecleonShop();
addObject(yeOldeKecleonShop,301,170);
EnterStart enterStart = new EnterStart();
addObject(enterStart,116,55);
}
private void FirstChange()
{
if(Greenfoot.isKeyDown("enter"))
{
Greenfoot.setWorld(new StartScreen());
}
}
}
