@Override
    public void draw(Graphics g) {
        if (moving) {
            frame += 0.3f;
            if (frame > activeAnimation.length) {
                frame = 0;
            }
            activeImage = activeAnimation[(int) frame];
        }
        int xd = x - (int) MainGame.camera.getX();
        int yd = y - (int) MainGame.camera.getY();
        if (MainGame.camera.intersects(x, y, 1, 1)) {
            g.drawImage(activeImage, xd, yd, width, height, null);
            g.drawRect(xd, yd, width - 5, height);
            g.drawString(username, xd, yd - 5);
        }
    }