Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define draw-game
- (lambda (g)
- (letrec ((newgame ((game-behaviour g) g))
- (pc (game-pacman g))
- (f (game-field g))
- (offs (round (/ (- tile-width (* 2 (pacman-r pc))) 2)))
- ; böse, aber aus Performancegründen leider notwendig
- (_ (set! draw-field (if (= (score-lives (game-score newgame)) 0)
- (field-image start-field)
- (freeze
- (draw-tile " "
- (tile-x (field-tile f))
- (tile-y (field-tile f))
- draw-field))))))
- (place-image (draw-score g)
- 200 30
- (fold
- (if (and (= (pacman-col pc) 0)
- (= (pacman-row pc) 17)
- (string=? (pacman-current-dir pc) "left"))
- (underlay/xy
- draw-field
- 0
- (+ (+ (* tile-width (pacman-row pc)) (span (pacman-offset-row pc))) offs)
- (crop-left (abs (pacman-offset-col pc)) (draw-pacman pc)))
- (underlay/xy
- draw-field
- (+ (+ (* tile-width (pacman-col pc)) (span (pacman-offset-col pc))) offs)
- (+ (+ (* tile-width (pacman-row pc)) (span (pacman-offset-row pc))) offs)
- (draw-pacman pc)))
- (lambda (gh img)
- (if (and (= (ghost-col gh) 0)
- (= (ghost-row gh) 17)
- (string=? (ghost-dir gh) "left"))
- (underlay/xy
- img
- 0
- (+ (+ (* tile-width (ghost-row gh)) (span (ghost-offset-row gh))) offs)
- (crop-left (abs (ghost-offset-col gh)) (draw-ghost gh)))
- (underlay/xy
- img
- (+ (+ (* tile-width (ghost-col gh)) (span (ghost-offset-col gh))) offs)
- (+ (+ (* tile-width (ghost-row gh)) (span (ghost-offset-row gh))) offs)
- (draw-ghost gh))))
- (game-ghosts g))))))
Add Comment
Please, Sign In to add comment