Guest User

Untitled

a guest
May 16th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 1.40 KB | None | 0 0
  1. (define draw-game
  2.   (lambda (g)
  3.     (letrec ((newgame ((game-behaviour g) g))
  4.              (pc (game-pacman g))
  5.              (f (game-field g))
  6.              (newscore (game-score newgame))
  7.              (newlives (score-lives newscore))
  8.              (offs (round (/ (- tile-width (* 2 (pacman-r pc))) 2)))
  9.              ; böse, aber aus Performancegründen leider notwendig
  10.              (_ (set! draw-field (if (= newlives 0)
  11.                                      (field-image start-field)
  12.                                      (freeze
  13.                                       (draw-tile " "
  14.                                                  (tile-x (field-tile f))
  15.                                                  (tile-y (field-tile f))
  16.                                                  draw-field))))))
  17.       (place-image (draw-score g)
  18.                    200 30
  19.                    (fold  
  20.        (underlay/xy      
  21.         draw-field
  22.         (+ (+ (* tile-width (pacman-col pc)) (span (pacman-offset-col pc))) offs)
  23.         (+ (+ (* tile-width (pacman-row pc)) (span (pacman-offset-row pc))) offs)
  24.         (draw-pacman pc))
  25.        (lambda (gh img)
  26.          (underlay/xy
  27.           img
  28.           (+ (+ (* tile-width (ghost-col gh)) (span (ghost-offset-col gh))) offs)
  29.           (+ (+ (* tile-width (ghost-row gh)) (span (ghost-offset-row gh))) offs)
  30.           (draw-ghost gh)))
  31.        (game-ghosts g))))))
Add Comment
Please, Sign In to add comment