public void update(GoldRushApplet app, Mine m) {
        if (Collision(m)) {
            app.ir.goldcount += currentgold;
            currentgold = 0;
            
            x = ux;
            y = uy;
            if (!(lives - 1 < 0)) {
                lives--;
            }
            if (lives == 0) {
                gameOver = true;
            }
        }
        
        if(a.il.goldcount == 5000 && currentgold == 0){
            win = true;
        }

        if (x + dx < 120) { // if close to left island
            x = 120;
            unload_x = x; // for unloading later
            timer.start();

        } else if (x + dx > app.ir.x - app.ir.width - 30) { // if close to right island
            x = app.ir.x - app.ir.width - 30;
            load_x = x;
            timer.start();
        }

        if (y + dy < 200) { // location of water edge
            y = 200;
        } else if (y + dy > app.getHeight() - img_r.getHeight(null)) {
            y = app.getHeight() - img_r.getHeight(null);
        }
    }