Hey guys,
i got an problem with starting my scenario. I want to start it if the key "p" is pressed.
The scenario was already started by the world, which also created the Object of the Class "Startscreen".
This is my code from the "Startscreen"-Class:
I cant start the scenario with pressing "p" ...
Any ideas?
public void act() { if (Greenfoot.isKeyDown("p") == true) { startSpiel(); } } public void startSpiel() { getWorld().addObject(((Welt)getWorld()).raumschiff, 500, 300); getWorld().addObject(((Welt)getWorld()).x, 950, 300); getWorld().addObject(((Welt)getWorld()).raumschiff, 500, 300); ((Welt)getWorld()).anzeigeZ.setText("Spielzeit:"); ((Welt)getWorld()).anzeigeP.setText("Punkte:"); ((Welt)getWorld()).anzeigeM.setText("Munition:"); getWorld().addObject(((Welt)getWorld()).anzeigeZ, 138, 560); getWorld().addObject(((Welt)getWorld()).anzeigeP, 111, 530); getWorld().addObject(((Welt)getWorld()).anzeigeM, 130, 500); getWorld().removeObject(this); }