This site requires JavaScript, please enable it in your browser!
Greenfoot back
fxrrxr
fxrrxr wrote ...

2017/3/16

enter

fxrrxr fxrrxr

2017/3/16

#
hello how can i make my game start by clicking "enter" on the keyboard?? how do i code that
Super_Hippo Super_Hippo

2017/3/16

#
What exactly do mean with "start"? Should everything be there immediately and when pressing enter, objects will start moving etc. (like pressing 'run' when hitting enter)? Do you want to have nothing at the start and when pressing enter, the world is created and starts running?
danpost danpost

2017/3/16

#
The basic code for detecting a single key entry (for "enter" key) is:
1
if ("enter".equals(Greenfoot.getKey()))
Your scenario must already be running and the code must be in an act method (or a method it calls) of a currently active object (either the currently active world or an actor that is currently in that world) .
You need to login to post a reply.