public void draw(Graphics2D graphics) {
        if (sprite != null) {
            if (angle != Math.PI / 2 && Preferences.getValue("fancyGraphics") == 1) {
                double theta = Math.PI / 2 - angle,
                       centerx = rect.x + rect.width / 2,
                       centery = rect.y + rect.height / 2;
                AffineTransform at = new AffineTransform();
                at.translate(centerx, centery);
                at.rotate(theta);
                at.translate(-rect.width / 2, -rect.height / 2);
                graphics.drawImage(sprite.getPaint(rect).getImage(), at, null);
            }
            else {
                graphics.setPaint(sprite.getPaint(rect));
                graphics.fill(rect);
            }
            if (Preferences.getValue("devMode") == 1) {
                graphics.setColor(Color.WHITE);
                graphics.draw(rect);
                graphics.setColor(Color.BLUE);
                int ourx = (int) getRect().x + (int) getRect().width/2;
                int oury = (int) getRect().y + (int) getRect().height/2;
                graphics.drawLine(ourx, oury, ourx + (int) xvel * 10, oury + (int) yvel * 10);
            }
        }
    }