I want to let my Object ( bullet ) wait everytime it moved. So when it moves x+1 it has to wait first before it goes again. I thought i can do this with Greenfoot.delay(1); but it doesnt work because it pauses the whole scenario, which i dont want to stop. Heres the code:
public void bulletMove() { System.out.println("Moved!"); while(bulletCheck() == false ) { int xPos = getX(); int yPos = getY(); int rotation = getRotation(); switch(rotation) { case 0: this.setLocation(xPos + 1, yPos); Greenfoot.delay(1); break; case 90: this.setLocation(xPos, yPos + 1); Greenfoot.delay(1); break; case 180: this.setLocation(xPos - 1, yPos); Greenfoot.delay(1); break; case 270: this.setLocation(xPos, yPos - 1); Greenfoot.delay(1); break; } } if(bulletCheck() == true ) { getWorld().removeObject(this); System.out.println(this + " Got removed!"); } }