public void draw(Sprite sprite, int x, int y) {
        if (x >= -sprite.getWidth() && y >= -sprite.getHeight() && x <= w + sprite.getWidth() && y <= h + sprite.getHeight()) {
            Graphics2D g = this.getGraphics();
            g.drawImage(sprite.getImage(), x, y, null);
            g.dispose();
        }
    }