Hello,
I have a problem with my new shooter game.It don't start and crashing instantly.I don't know what I did wrong.
Here's the code from my shooter:
and here's the code from my bullet:
public class shooter1 extends Actor { public static boolean richtung = true; public void act() { GreenfootImage lul= new GreenfootImage("links.png"); GreenfootImage lal= new GreenfootImage("pixil-frame-0.png"); while(getImage() == lul){ richtung = true; } while(getImage() == lal){ richtung = false; } if(Greenfoot.isKeyDown("d")){ setLocation(getX() + 5,getY()); setImage("pixil-frame-0.png"); } if(Greenfoot.isKeyDown("a")){ setLocation(getX() - 5,getY()); setImage("links.png"); } if(Greenfoot.isKeyDown("w")){ setLocation(getX(),getY() -5); } if(Greenfoot.isKeyDown("s")){ setLocation(getX(),getY() + 5); } if(Greenfoot.isKeyDown("space")){ getWorld().addObject(new bullet(),getX(),getY()); } } }
public void act() { while(shooter1.richtung == true) { move(-10); while(shooter1.richtung != true) { move(10); } }