@Override
    public void act() {
        getImage().scale(40, 40);
        checkFall();
        onTouchMovingBrick();
        if (speed / 4 <= 0) speed = 4;

        if (Greenfoot.isKeyDown("a")) {
            move(-speed / 4, 0);
            switchImageLeft();
        }

        if (Greenfoot.isKeyDown("d")) {
            move(+speed / 4, 0);
            switchImageRight();
        }
        
        if (Greenfoot.isKeyDown("space") && jumping == false) {
            jump();
        }
        
        int waterOffset = 70 - ((SkyscraperWorld)getWorld()).getWaterLevel() / 2 / 10;
        if (waterOffset <= getY()) {
             ((SkyscraperWorld)getWorld()).loseLife();
            return;
        }

        
        
        Actor coin = getOneIntersectingObject(SkyscraperCoin.class);
        if (coin != null) {
            GreenfootSound coinSound = new GreenfootSound("Coin.wav");
            coinSound.setVolume(75); 
            coinSound.play();
            getWorld().removeObject(coin);
            ((SkyscraperWorld)getWorld()).getScoreCounter().add(10);
        } 
    }