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

2012/12/8

Exception in thread "Thread-187" java.lang.IllegalArgumentException: image == null!

QuestionMark QuestionMark

2012/12/8

#
I'm trying to upload a game of mine onto Greenfoot, but I get this error. It converts to a applet just fine, but it won't upload here. here's the code for the main world,
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.SplashScreen;
/**
 * Write a description of class ForestPath here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ForestPath extends World
{
private boolean OneGirl;
private boolean Start;
public ForestPath(){
    super(600, 400, 1); 
    OneGirl=true;
    Start = true;
    Greenfoot.start();
    addObject(new Start(), 300, 200);
}
public void addGirl(){
    Girl ann = new Girl();
        int x = 20;
        int y = 250;
        this.addObject(ann, x, y);
}
public void addDemon(){
    int number = Greenfoot.getRandomNumber(100);
      if (number < 50){
         FireDemon fire = new FireDemon();
         int x = 550;
         int y = 250;
         this.addObject(fire, x, y);
    }
     if (number >= 50){
         IceDemon ice = new IceDemon();
         int t = 550;
         int q = 250;
         this.addObject(ice, t, q);
     }
}
public void addCharacters(){
        addGirl();
    
    if(Girl.ReturnPosition()){
        addDemon();
    }
}
  public void act(){
      if(this.OneGirl){
          addCharacters();
          this.OneGirl=false;
        }
   
      
//       Greenfoot.playSound("E:\\C251\\Danse Macabre.mp3");
    /**
     * Constructor for objects of class ForestPath.
     * 
     */
   
}
}
and here's the code for the main actor, Girl
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Girl here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Girl extends Actor{
int r = 0;
public static boolean GirlPosition=false;
    public Girl(){
       
    }
    /**
     * Act - do whatever the Girl wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act(){
       World myWorld=(World)this.getWorld();
       String key = Greenfoot.getKey();
       if("up".equals(key)){ 
           getWorld().addObject(new SunshineSpell(), getX()+8, getY()-5); 
        }

       else if("down".equals(key)){ 
           getWorld().addObject(new RainfallSpell(), getX()+8, getY()-5); 
        }
       if(Greenfoot.isKeyDown("right")){
            this.move(10);
        }
       if(Greenfoot.isKeyDown("left")){
            this.move(-10);
        }
       double dist = this.getX();
       FireDemon fire = new FireDemon();
       IceDemon ice = new IceDemon();
       int number = Greenfoot.getRandomNumber(100);
       if(dist==580){
            this.setLocation(20, 250);
            if(number < 50){
                int x = 550;
                int y = 250;
                myWorld.addObject(fire, x, y);
            }
            if(number >= 50){
                int t = 550;
                int q = 250;
                myWorld.addObject(ice, t, q);
             }   
        r++;
        WinWorld w = new WinWorld();
         if(r==10){
            Greenfoot.setWorld(w);
        }
       }
}
public static boolean ReturnPosition(){
    return GirlPosition;
}
}
danpost danpost

2012/12/8

#
I have a feeling that it is not locating the splashscreen image on the site. Remove the import and see if it uploads then.
You need to login to post a reply.