summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-15 22:02:55 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:44 +0200
commit31e6d98d174b0667a04d2e8737d35727f80c86cb (patch)
treeed08c650a7799291beeeb8c711aff22dafa615c3
parent5bd23bd6e0dbd1a4316d3ff0d4d3fca72f333961 (diff)
Remove global %player variable.
-rw-r--r--scenes/game.scm13
1 files changed, 3 insertions, 10 deletions
diff --git a/scenes/game.scm b/scenes/game.scm
index 1e983fe..4c052e6 100644
--- a/scenes/game.scm
+++ b/scenes/game.scm
@@ -52,7 +52,7 @@
(hitbox #:getter hitbox #:init-form (make-rect 8.0 0.0 16.0 16.0)))
(define-class <stats> (<node-2d>)
- (player #:accessor player #:init-form #f #:init-keyword #:player))
+ (object #:accessor object #:init-form #f #:init-keyword #:object))
(define-method (walk (character <character>) directions . rest)
(unless (equal? (direction character) directions)
@@ -143,10 +143,6 @@
(load-tile-font "assets/fonts/bubblemad_8x8.png" 8 8
" !\"©_%❤'()*+,-./0123456789:←<=>?@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"))
-;; TODO: hack :(
-;; TODO: It's ugly to use the global variable %player here, but
-;; (player stats) below always returns #f.
-(define %player #f)
(define-method (populate (game <game>))
(let ((player (make <player>
@@ -167,7 +163,6 @@
(list 12 10 8 10 12)
;; widths
(list 8 12 16 12 8))))))
- (set! %player player)
(list (make <reaper>
#:name 'reaper
#:position (vec2 720.0 1100.0)
@@ -196,7 +191,7 @@
#:name 'top-layer
#:position (vec2 0.0 0.0))
(make <stats>
- #:name 'stats #:player player
+ #:name 'stats #:object player
#:position (vec2 10.0 (- %height 10.0))))))
(define* (collides? player game #:key (layer "collision"))
@@ -287,9 +282,7 @@
music
career
curiosity))
- ;; FIXME
- (player %player;(player stats)
- ))
+ (player (object stats)))
(for-each (lambda (property index)
(let* ((value (property player))
(start (vec2 x (- y (* step index))))