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

2016/5/25

'Run' Problem

Ty1erH00ven Ty1erH00ven

2016/5/25

#
As said before, I am creating a 'Flappy Bird' type game and am having troubles with a start screen. I have the class so when one presses the 'Start' button they move to the first level. But I don't want to have to press 'Run' then 'Start' then 'Run' again just to play. Is there any way I can be able to press 'Start' without having to 'Run' Greenfoot first? Or at least a way I can press 'Run' then 'Start'? (My 'Start' button is a class)
SPower SPower

2016/5/25

#
Do you mean letting Greenfoot start running the scenario automatically? In that case, after you're done creating the world (in this case, the start screen), you run this:
Greenfoot.start(); // this does the same as pressing the 'start' button on Greenfoot
Although I don't know about your implementation, I would expect you to have to place this at the end of the constructor of your start screen world.
danpost danpost

2016/5/25

#
Some things you could do: (1) add a 'Greenfoot.start();' line in your initial world constructor so the user does not have to press the 'Run' button at all; (2) add a 'public void started()' method to your initial world class and remove the button so that pressing 'Run' starts the first level;
Ty1erH00ven wrote...
Or at least a way I can press 'Run' then 'Start'?
This is what you should already have.
Ty1erH00ven wrote...
I don't want to have to press 'Run' then 'Start' then 'Run' again just to play
Unless you have a 'Greenfoot.stop();' line in one of your world class constructors, you should not have this behavior. If you cannot resolve this, you will need to show your world class codes.
You need to login to post a reply.