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

2018/1/9

I just wanna spawn one ball

Sarwa35 Sarwa35

2018/1/9

#
Hey Guys Ihave a Problem.I am want to spawn at 30 seconds another Ball but it spawns like 20 .How can i do that ?
  public MyWorld() {
    super (640,400,1);
    this.addObject( new Ball3(),100,100);
    
    
}
    int Zeit = 0;
int counter = 0;
    public void act() 
    {
           
            Greenfoot.delay(1);
Zeit = Zeit+1;
if ( Zeit==100){
    
Zeit = 0;
counter = counter+1;

}
    showText((counter)+"Zeit",30,40);
      if (counter==30){
    this.addObject(new Ball2(),100,100);
    }
    }
}
danpost danpost

2018/1/9

#
Answered on another discussion thread. (Do not create multiple threads on the same issue please)
You need to login to post a reply.