Guest User

Untitled

a guest
May 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 2.50 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.                     (if ( < (+ (+ (* tile-width (pacman-col pc)) (span (pacman-offset-col pc))) offs) 0)
  21.                        
  22.                         (underlay/xy      
  23.                          draw-field
  24.                          0
  25.                          (+ (+ (* tile-width (pacman-row pc)) (span (pacman-offset-row pc))) offs)
  26.                          (crop 0 0 0 0 (draw-pacman pc)))
  27.                        
  28.                         (underlay/xy      
  29.                          draw-field
  30.                          (+ (+ (* tile-width (pacman-col pc)) (span (pacman-offset-col pc))) offs)
  31.                          (+ (+ (* tile-width (pacman-row pc)) (span (pacman-offset-row pc))) offs)
  32.                          (draw-pacman pc)))
  33.                        
  34.                        
  35.                     (lambda (gh img)
  36.                       (if ( < (+ (+ (* tile-width (pacman-col pc)) (span (pacman-offset-col pc))) offs) 0)
  37.                          
  38.                           (underlay/xy
  39.                            img
  40.                            0
  41.                            (+ (+ (* tile-width (ghost-row gh)) (span (ghost-offset-row gh))) offs)
  42.                            (crop 0 0 0 0(draw-ghost gh)))
  43.                      
  44.                           (underlay/xy
  45.                            img
  46.                            (+ (+ (* tile-width (ghost-col gh)) (span (ghost-offset-col gh))) offs)
  47.                            (+ (+ (* tile-width (ghost-row gh)) (span (ghost-offset-row gh))) offs)
  48.                            (draw-ghost gh))))
  49.                      
  50.                       (game-ghosts g))))))
Add Comment
Please, Sign In to add comment