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

2020/1/21

Need help

N1C0 N1C0

2020/1/21

#
can someone pls tell me whats wrong here i want to create two objects with a delay of 5000 in between
        
        for (int i=0;i<2;i++) {
            Greenfoot.delay(5000);
            
            x=Greenfoot.getRandomNumber(600);
            this.addObject(new bee(), x, 20);
            
            
        }
danpost danpost

2020/1/22

#
N1C0 wrote...
i want to create two objects with a delay of 5000 in between << Code Omitted >>
Is the entire scenario to be paused until both are created? If not, then you cannot use the delay method. you would need to use an int timer field.
You need to login to post a reply.