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

2019/3/10

Greenfoot.ask showing up before the world

Kang Kang

2019/3/10

#
public PredatorPopulation()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(600, 400, 1); 
        PrePop = Integer.parseInt(Greenfoot.ask("How many population?"));
    }
What I expect is after pressing enter from the start world, the set up world will show up and do Greenfoot.Ask but what actually happens is when I press enter form the start world, it does greenfoot.ask first then changes to set up world. Any solution for this?
danpost danpost

2019/3/10

#
Kang wrote...
<< Code Omitted >> What I expect is after pressing enter from the start world, the set up world will show up and do Greenfoot.Ask but what actually happens is when I press enter form the start world, it does greenfoot.ask first then changes to set up world. Any solution for this?
You will probably have to override the World act method in the PredatorPopulation class to perform the "ask".
You need to login to post a reply.