Hallo zusammen,
ich muss für die Schule ein Informatik-Projekt machen und möchte gerne die BANANA nach wenigen Sekunde verschwinden, jedoch nach wenigen Sekunden wieder spawnen lassen.
Mein Problem ist, dass ich, seitdem ich diesen Part:
timer3 = timer3 + 1;
if (timer3 > 500) {
getWorld().removeObject(this);
}
benutzt habe, zwar die BANANA verschwindet, mein Programm allerdings danach anhält.
Hat jemand eine Idee, was ich machen kann?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class BANANA extends Actor {
public static int Score;
int timer3;
public BANANA() {
getImage().scale(30, 30);
}
public void act() {
timer3 = timer3 + 1;
if (timer3 > 500) {
getWorld().removeObject(this);
}
if (isTouching(Spieler.class)) {
getWorld().removeObject(this);
Score = Score + 10;
}
}
public void Score() {
}
}