Compare commits
2 commits
f06e510505
...
16e5dc1cdf
Author | SHA1 | Date | |
---|---|---|---|
16e5dc1cdf | |||
8412883500 |
1 changed files with 17 additions and 12 deletions
29
game.scm
29
game.scm
|
@ -79,17 +79,21 @@
|
||||||
(define (collide-gelement! x y parenthes)
|
(define (collide-gelement! x y parenthes)
|
||||||
(dprint "x" x)
|
(dprint "x" x)
|
||||||
(dprint "y" y)
|
(dprint "y" y)
|
||||||
(let ((e (vector-ref (vector-ref (level-grid *level*) y) x)))
|
(if (and (>= x 0) (>= y 0))
|
||||||
(dprint "content" (parentheses-content parenthes))
|
(let ((e (vector-ref (vector-ref (level-grid *level*) y) x))
|
||||||
(if (gelement-interact? (gelement-type e))
|
(len (vector-length (level-grid *level*))))
|
||||||
(begin
|
(dprint "content" (parentheses-content parenthes))
|
||||||
(dprint "Move!")
|
(dprint "par pos" (parentheses-pos parenthes))
|
||||||
(set-grid! x y air)
|
(if (and (<= x len) (<= y len))
|
||||||
(set-parentheses-pos! parenthes (cons x y))
|
(if (gelement-interact? (gelement-type e))
|
||||||
(set-parentheses-content! parenthes (append (parentheses-content parenthes) (gelement-content e)))
|
(begin
|
||||||
(dprint "after-content" (parentheses-content parenthes))
|
(dprint "Move!")
|
||||||
(dprint "grid" (level-grid *level*)))
|
(set-grid! x y air)
|
||||||
(dprint "Boop!"))))
|
(set-parentheses-pos! parenthes (cons x y))
|
||||||
|
(set-parentheses-content! parenthes (append (parentheses-content parenthes) (gelement-content e)))
|
||||||
|
(dprint "after-content" (parentheses-content parenthes)))
|
||||||
|
(dprint "Boop!"))))
|
||||||
|
(dprint "Boop!")))
|
||||||
|
|
||||||
(define (collide-pareneheses! level)
|
(define (collide-pareneheses! level)
|
||||||
(let ((left-parenthes (level-left-parenthes level))
|
(let ((left-parenthes (level-left-parenthes level))
|
||||||
|
@ -122,11 +126,12 @@
|
||||||
(cond
|
(cond
|
||||||
((string=? key key:left)
|
((string=? key key:left)
|
||||||
(dprint "key:" key)
|
(dprint "key:" key)
|
||||||
|
(collide-gelement! (- (car (parentheses-pos (level-left-parenthes *level*))) 1) (cdr (parentheses-pos (level-left-parenthes *level*))) (level-left-parenthes *level*))
|
||||||
(set! *element-x* (- *element-x* 10)))
|
(set! *element-x* (- *element-x* 10)))
|
||||||
((string=? key key:right)
|
((string=? key key:right)
|
||||||
(dprint "key:" key)
|
(dprint "key:" key)
|
||||||
(set! *element-x* (+ *element-x* 10))
|
(set! *element-x* (+ *element-x* 10))
|
||||||
(collide-gelement! (+ 1 (car (parentheses-pos (level-left-parenthes *level*)))) (cdr (parentheses-pos (level-left-parenthes *level*))) (level-left-parenthes *level*))
|
(collide-gelement! (+ (car (parentheses-pos (level-left-parenthes *level*))) 1) (cdr (parentheses-pos (level-left-parenthes *level*))) (level-left-parenthes *level*))
|
||||||
))))
|
))))
|
||||||
|
|
||||||
(add-event-listener! (current-document) "keydown"
|
(add-event-listener! (current-document) "keydown"
|
||||||
|
|
Loading…
Reference in a new issue