Adapt to new flexibility in spawn startup actions

This commit is contained in:
Tony Garnock-Jones 2015-12-03 13:07:04 -08:00
parent cb6f60739d
commit f3643601d4
1 changed files with 52 additions and 49 deletions

View File

@ -344,8 +344,8 @@
`())))] `())))]
[_ #f])) [_ #f]))
(scene-manager-state (vector 0 0) (vector 0 0)) (scene-manager-state (vector 0 0) (vector 0 0))
(sub (scroll-offset ?)) (patch-seq (sub (scroll-offset ?))
(sub (window ? ?) #:meta-level 1))) (sub (window ? ?) #:meta-level 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ScoreKeeper ;; ScoreKeeper
@ -591,10 +591,10 @@
(hash) (hash)
(hash) (hash)
(hash)) (hash))
(sub (impulse ? ?)) (patch-seq (sub (impulse ? ?))
(sub (game-piece-configuration ? ? ? ?)) (sub (game-piece-configuration ? ? ? ?))
(sub (jump-request ?)) (sub (jump-request ?))
(sub (frame-event ? ? ? ?) #:meta-level game-level))) (sub (frame-event ? ? ? ?) #:meta-level game-level))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Player ;; Player
@ -657,18 +657,19 @@
(quit))] (quit))]
[_ #f])) [_ #f]))
initial-player-state initial-player-state
(sub (damage player-id ?)) (patch-seq
(assert (health player-id (player-state-hit-points initial-player-state))) (sub (damage player-id ?))
(assert (game-piece-configuration player-id (assert (health player-id (player-state-hit-points initial-player-state)))
initial-top-left (assert (game-piece-configuration player-id
(icon-hitbox-size i) initial-top-left
(set 'player 'mobile 'massive))) (icon-hitbox-size i)
(sub (position player-id ? ?)) (set 'player 'mobile 'massive)))
(sub (key-pressed 'left) #:meta-level 2) (sub (position player-id ? ?))
(sub (key-pressed 'right) #:meta-level 2) (sub (key-pressed 'left) #:meta-level 2)
(sub (key-pressed #\space) #:meta-level 2) (sub (key-pressed 'right) #:meta-level 2)
(sprite-update initial-player-state) (sub (key-pressed #\space) #:meta-level 2)
)) (sprite-update initial-player-state)
)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Ground Block ;; Ground Block
@ -682,11 +683,12 @@
(match e (match e
[_ #f])) [_ #f]))
(void) (void)
(update-sprites #:meta-level game-level (simple-sprite 0 x y w h block-pict)) (patch-seq
(assert (game-piece-configuration block-id (update-sprites #:meta-level game-level (simple-sprite 0 x y w h block-pict))
top-left (assert (game-piece-configuration block-id
size top-left
(set 'solid))))) size
(set 'solid))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Goal piece ;; Goal piece
@ -704,12 +706,13 @@
[(? patch/added?) (transition s (message (at-meta (level-completed))))] [(? patch/added?) (transition s (message (at-meta (level-completed))))]
[_ #f])) [_ #f]))
(void) (void)
(assert (game-piece-configuration goal-id (patch-seq
initial-top-left (assert (game-piece-configuration goal-id
(icon-hitbox-size i) initial-top-left
(set 'touchable))) (icon-hitbox-size i)
(sub (touching player-id goal-id ?)) (set 'touchable)))
(update-sprites #:meta-level game-level (icon-sprite i -1 initial-top-left)))) (sub (touching player-id goal-id ?))
(update-sprites #:meta-level game-level (icon-sprite i -1 initial-top-left)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enemy ;; Enemy
@ -788,15 +791,16 @@
(damage-contacts p))] (damage-contacts p))]
[_ #f])) [_ #f]))
initial-state initial-state
(assert (game-piece-configuration enemy-id (patch-seq
initial-top-left (assert (game-piece-configuration enemy-id
(icon-hitbox-size i) initial-top-left
(set 'mobile 'massive 'touchable))) (icon-hitbox-size i)
(sub (level-size ?)) (set 'mobile 'massive 'touchable)))
(sub (position enemy-id ? ?)) (sub (level-size ?))
(sub (touching player-id enemy-id ?)) (sub (position enemy-id ? ?))
(motion-patch initial-state) (sub (touching player-id enemy-id ?))
(sprite-patch initial-state initial-top-left))) (motion-patch initial-state)
(sprite-patch initial-state initial-top-left))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DisplayControl ;; DisplayControl
@ -836,9 +840,9 @@
(update-scroll-offset-from-player-position p))] (update-scroll-offset-from-player-position p))]
[_ #f])) [_ #f]))
(vector 0 0) (vector 0 0)
(sub (window ? ?) #:meta-level game-level) (patch-seq (sub (window ? ?) #:meta-level game-level)
(sub (position player-id ? ?)) (sub (position player-id ? ?))
(assert (level-size level-size-vec)))) (assert (level-size level-size-vec)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LevelTerminationMonitor ;; LevelTerminationMonitor
@ -857,18 +861,17 @@
(transition s (quit-world))] (transition s (quit-world))]
[_ #f])) [_ #f]))
(void) (void)
(sub (game-piece-configuration player-id ? ? ?)) (patch-seq (sub (game-piece-configuration player-id ? ? ?))
(sub (level-completed) #:meta-level 1) (sub (level-completed) #:meta-level 1)
(assert (level-running) #:meta-level 1))) (assert (level-running) #:meta-level 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LevelSpawner ;; LevelSpawner
(define (spawn-standalone-assertions . patches) (define (spawn-standalone-assertions . patches)
(<spawn> (lambda () (<spawn> (lambda ()
(list (patch-seq* patches) (list (lambda (e s) #f)
(lambda (e s) #f) (transition (void) (patch-seq* patches))))))
(void)))))
(define (spawn-background-image level-size scene) (define (spawn-background-image level-size scene)
(match-define (vector level-width level-height) level-size) (match-define (vector level-width level-height) level-size)
@ -958,8 +961,8 @@
(transition (struct-copy level-spawner-state s [level-complete? #t]) '())] (transition (struct-copy level-spawner-state s [level-complete? #t]) '())]
[_ #f])) [_ #f]))
(level-spawner-state starting-level #f) (level-spawner-state starting-level #f)
(sub (level-running)) (patch-seq (sub (level-running))
(sub (level-completed))) (sub (level-completed))))
(spawn-numbered-level starting-level))) (spawn-numbered-level starting-level)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;