src/Handler.java
/**
     * Loads level by image
     * @param image BufferedImage
     */
Loads level by image
@param image BufferedImage
Loads level by image @param image BufferedImage
public void loadImageLevel(BufferedImage image){
        int w = image.getWidth();
        int h = image.getHeight();
        int txtcount = 0;
        for(int x=0;x<w;x++){
            for(int y=0;y<h;y++){
                int pixel = image.getRGB(x,y);
                int red = (pixel >> 16) & 0xff;
                int green = (pixel >> 8) & 0xff;
                int blue = (pixel) & 0xff;
                if(red == 0 && green == 0 && blue == 0){
                    this.add(new Platform(x*40,y*40,40,40,ObjectId.Platform));
                }else if(red == 0 && green == 255 && blue == 0){
                    this.add(new Waypoint(x*40,y*40,ObjectId.Waypoint));
                }else if(red == 255 && green == 0 && blue == 0){
                    this.add(new Food(x*40,y*40,ObjectId.Food,true));
                }else if(red == 0 && green == 0 && blue == 255){
                    this.add(new Food(x*40,y*40,ObjectId.Food,false));
                }else if(red == 0 && green == 200 && blue == 200){
                    this.add(new WaterBottle(x*40,y*40,ObjectId.Water));
                }else if(red == 0 && green == 255 && blue == 255){
                    this.add(new Text(x*40,y*40, text[Game.level-1][txtcount][0],text[Game.level-1][txtcount][1],text[Game.level-1][txtcount][2],ObjectId.Text));
                    txtcount++;
                }
            }
        }
        Game.score = 60000;
    }
public void loadImageLevel ( BufferedImage image ) { int w = image . getWidth ( ) ; int h = image . getHeight ( ) ; int txtcount = 0 ; for ( int x = 0 ; x < w ; x ++ ) { for ( int y = 0 ; y < h ; y ++ ) { int pixel = image . getRGB ( x , y ) ; int red = ( pixel >> 16 ) & 0xff ; int green = ( pixel >> 8 ) & 0xff ; int blue = ( pixel ) & 0xff ; if ( red == 0 && green == 0 && blue == 0 ) { this . add ( new Platform ( x * 40 , y * 40 , 40 , 40 , ObjectId . Platform ) ) ; } else if ( red == 0 && green == 255 && blue == 0 ) { this . add ( new Waypoint ( x * 40 , y * 40 , ObjectId . Waypoint ) ) ; } else if ( red == 255 && green == 0 && blue == 0 ) { this . add ( new Food ( x * 40 , y * 40 , ObjectId . Food , true ) ) ; } else if ( red == 0 && green == 0 && blue == 255 ) { this . add ( new Food ( x * 40 , y * 40 , ObjectId . Food , false ) ) ; } else if ( red == 0 && green == 200 && blue == 200 ) { this . add ( new WaterBottle ( x * 40 , y * 40 , ObjectId . Water ) ) ; } else if ( red == 0 && green == 255 && blue == 255 ) { this . add ( new Text ( x * 40 , y * 40 , text [ Game . level - 1 ] [ txtcount ] [ 0 ] , text [ Game . level - 1 ] [ txtcount ] [ 1 ] , text [ Game . level - 1 ] [ txtcount ] [ 2 ] , ObjectId . Text ) ) ; txtcount ++ ; } } } Game . score = 60000 ; }
Loads level by image
 @param image BufferedImage
Loads level by image @param image BufferedImage