I am using Greenfoot for the first time and I am making a Donkey Kong Game. Everything is work fine but the only problem I have is how to stimulate a barrel with a delay in between each barrel.
These functions are present in the World class. lunchBarrels function is call on the World class constructor.
The problem is that it is not working as I planned. If any body has an idea on how to solve this problem , I will really like you input.
Thank in advance
public void lunchBarrels(){ for(int i = 0; i < 50; i++){ addObject(Barrel.class, Greenfoot.getRandomNumber(1300), 118); this.delayObjectInstantiation(); } public void delayObjectInstantiation(){ int delay = 50; while(delay > 0){ delay--; if(delay == 0) return; } }