src/Player.java
/**
     * Update method
     * @param objects Object list passed from handler
     */
Update method
@param objects Object list passed from handler
Update method @param objects Object list passed from handler
public void update(ArrayList<GameObject> objects){
        if(!sleeping){
            x += velX;
            w = imageL.getWidth();
            h = imageL.getHeight();
            if(velX != 0){
                energy = Math.max(energy-0.05,0);
            }
        }else{
            energy = Math.min(energy+0.1,100);
            if(energy <  100) sleeptime = Math.min(sleeptime+0.1,200);
        }
        y += velY;
        falling = true;
        if(falling || jumping){
            velY += gravity;
            if(velY > MAX_VEL){
                velY = MAX_VEL;
            }
        }
        if(y > 1450){
            this.reset();
            handler.setLevel(Game.level);
        }
        if(velX < 0) lastDir = "L";
        else if(velX > 0) lastDir = "R";    
        if(h >= 115 || (energy <= 0 && Game.level == 3)) speed = 1;
        else if(h >= 105) speed = 2;
        else if(h >= 90) speed = 3;
        else if(h >= 80) speed = 4;
        else if(h >= 70) speed = 5;
        else if(h >= 60) speed = 6;
        else if(h >= 50) speed = 7;
        if(Game.level == 4){
            speed = 3;
            try{
                imageL = ImageIO.read(new File("images/blobL75.png"));
                imageR = ImageIO.read(new File("images/blobR75.png"));
            }catch(IOException e){} 
        }
        checkCollision();
    }
public void update ( ArrayList < GameObject > objects ) { if ( ! sleeping ) { x += velX ; w = imageL . getWidth ( ) ; h = imageL . getHeight ( ) ; if ( velX != 0 ) { energy = Math . max ( energy - 0.05 , 0 ) ; } } else { energy = Math . min ( energy + 0.1 , 100 ) ; if ( energy < 100 ) sleeptime = Math . min ( sleeptime + 0.1 , 200 ) ; } y += velY ; falling = true ; if ( falling || jumping ) { velY += gravity ; if ( velY > MAX_VEL ) { velY = MAX_VEL ; } } if ( y > 1450 ) { this . reset ( ) ; handler . setLevel ( Game . level ) ; } if ( velX < 0 ) lastDir = "L" ; else if ( velX > 0 ) lastDir = "R" ; if ( h >= 115 || ( energy <= 0 && Game . level == 3 ) ) speed = 1 ; else if ( h >= 105 ) speed = 2 ; else if ( h >= 90 ) speed = 3 ; else if ( h >= 80 ) speed = 4 ; else if ( h >= 70 ) speed = 5 ; else if ( h >= 60 ) speed = 6 ; else if ( h >= 50 ) speed = 7 ; if ( Game . level == 4 ) { speed = 3 ; try { imageL = ImageIO . read ( new File ( "images/blobL75.png" ) ) ; imageR = ImageIO . read ( new File ( "images/blobR75.png" ) ) ; } catch ( IOException e ) { } } checkCollision ( ) ; }
Update method
 @param objects Object list passed from handler
Update method @param objects Object list passed from handler
// Falling too low
 // Last facing direction
 // Speed
 // Tutorial modifications
 // Resize blob to be a bit smaller for the tutorial
