java - Press [enter] to start the game, no error -
i trying function where, when press enter, start game, isn't working. there no error. have followed tutorial.
here code:
import greenfoot.*; /** * write description of class menu here. * * @author (your name) * @version (a version number or date) */ public class menu extends world { /** * constructor objects of class menu. * */ public menu() { // create new world 600x400 cells cell size of 1x1 pixels. super(800, 500, 1); prepare(); } public void start() { { if(greenfoot.iskeydown("enter")) { minionworld minionworld= new minionworld(); greenfoot.setworld(minionworld); } } } /** * prepare world start of program. is: create initial * objects , add them world. */ private void prepare() { controls controls = new controls(); addobject(controls, 300, 100); controls.setlocation(175, 50); } }
if(greenfoot.iskeydown("enter"))
change line
if(greenfoot.iskeydown("enter"))
key name enter "enter" small-caps.
Comments
Post a Comment