anchor.diff:                    :accessor shoot-angle)
        (shoot-force :initform 0
                     :accessor shoot-force)
  -     (target :accessor target)
  +     (target :initform nil
  +             :accessor target)
        (game-ended-p :initform nil
                      :accessor game-ended-p)
        (barrel-pressed-p :initform nil
  
positive.code:              (QSIGNAL "timeout()")
               instance
               (QSLOT "moveShot()"))
    (#_setPalette instance (#_new QPalette (#_new QColor 250 250 200)))
    (#_setAutoFillBackground instance (bool 1))
    (new-target instance))
  
  (defun new-target (instance)
    (setf (target instance)
          (#_new QPoint
                 (+ 200 (random 190))
  
negative.code:   (#_new QRect 145 (- (#_height instance) 100) 15 99))
  
  (defun barrel-hit-p (instance pos)
    (with-objects ((matrix (#_new QMatrix)))
      (#_translate matrix 0 (#_height instance))
      (#_rotate matrix (- (current-angle instance)))
      (with-objects ((br (barrel-rect))
                     (mapped-pos (#_map (#_inverted matrix) pos)))
        (#_contains br mapped-pos))))
  
  (defun target-rect (instance)
    (let ((result (#_new QRect 0 0 20 10)))
      (with-objects ((to (#_new QPoint
                                (#_x (target instance))
                                (- (#_height instance)
                                   1
                                   (#_y (target instance))))))
        (#_moveCenter result to))
      result))
  
  (defun barrel-rect ()
    (#_new QRect 30 -5 20 10))
  
  (defun shot-rect (instance)
    (with-objects ((barrel-rect (barrel-rect)))
      (let* ((gravity 4.0d0)
             (time (/ (timer-count instance) 20.0d0))
             (velocity (shoot-force instance))
             (radians (* (shoot-angle instance) (/ pi 180.0d0)))
             (velx (* velocity (cos radians)))
             (vely (* velocity (sin radians)))
             (x0 (* (+ (#_right barrel-rect) 5.0d0) (cos radians)))
             (y0 (* (+ (#_right barrel-rect) 5.0d0) (sin radians)))
             (x (+ x0 (* velx time)))
             (y (+ y0 (* vely time) (- (* 0.5d0 gravity time time))))
             (result (#_new QRect 0 0 6 6)))
        (with-objects ((to (#_new QPoint
                                  (round x)
                                  (- (#_height instance) 1 (round y)))))
          (#_moveCenter result to))
        result)))
  
  (defun is-shooting-p (instance)
    (#_isActive (auto-shoot-timer instance)))
  