add support for more levels and add victory celebration
This commit is contained in:
parent
9d99030f07
commit
5ddc4542f9
6 changed files with 59 additions and 20 deletions
11
Makefile.am
11
Makefile.am
|
@ -25,12 +25,14 @@ godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
game/util/assets.scm \
|
game/util/assets.scm \
|
||||||
game/util/pipe.scm \
|
game/util/pipe.scm \
|
||||||
game/model/level.scm \
|
|
||||||
game/model/hero.scm \
|
game/model/hero.scm \
|
||||||
|
game/model/key.scm \
|
||||||
|
game/model/level.scm \
|
||||||
game/model/other.scm \
|
game/model/other.scm \
|
||||||
game/model/runner.scm \
|
game/model/runner.scm \
|
||||||
game/render/level.scm \
|
|
||||||
game/render/hero.scm \
|
game/render/hero.scm \
|
||||||
|
game/render/key.scm \
|
||||||
|
game/render/level.scm \
|
||||||
game/render/other.scm \
|
game/render/other.scm \
|
||||||
game/main.scm
|
game/main.scm
|
||||||
|
|
||||||
|
@ -38,7 +40,10 @@ asset_files = \
|
||||||
assets/images/simples_pimples.png \
|
assets/images/simples_pimples.png \
|
||||||
assets/images/lr_penguin2.png \
|
assets/images/lr_penguin2.png \
|
||||||
assets/images/glamshot.png \
|
assets/images/glamshot.png \
|
||||||
assets/levels/level-1.map
|
assets/images/boxart.png \
|
||||||
|
assets/images/victory.jpg \
|
||||||
|
assets/levels/level-001.map \
|
||||||
|
assets/levels/level-002.map
|
||||||
|
|
||||||
nobase_dist_pkgdata_DATA = $(asset_files)
|
nobase_dist_pkgdata_DATA = $(asset_files)
|
||||||
|
|
||||||
|
|
11
README.org
11
README.org
|
@ -36,7 +36,7 @@ let the _others_ fall in so you can pass over their head.
|
||||||
So now, go out, collect the keys and maintain a healthy diet!
|
So now, go out, collect the keys and maintain a healthy diet!
|
||||||
|
|
||||||
|
|
||||||
* Game Plan [12/20]
|
* Game Plan [16/21]
|
||||||
|
|
||||||
- [X] start project organization
|
- [X] start project organization
|
||||||
- [X] select some assets to start with
|
- [X] select some assets to start with
|
||||||
|
@ -54,13 +54,14 @@ So now, go out, collect the keys and maintain a healthy diet!
|
||||||
- [X] create other's AI
|
- [X] create other's AI
|
||||||
- [X] add keys and portal
|
- [X] add keys and portal
|
||||||
- [X] make other avoid each other
|
- [X] make other avoid each other
|
||||||
- [ ] Detect success reaching the goal and progress to next level
|
- [X] ask AI for some boxart
|
||||||
|
- [X] Detect success reaching the goal and progress to next level
|
||||||
- [ ] add foods and bloat indicator
|
- [ ] add foods and bloat indicator
|
||||||
- [ ] scale hero waist related to bloat level
|
- [ ] scale hero waist related to bloat level
|
||||||
- [ ] create more levels
|
- [X] create more levels
|
||||||
- [ ] dig potholes
|
- [ ] dig potholes
|
||||||
- [ ] make others steal keys
|
- [ ] make others steal keys
|
||||||
- [ ] some level celebration/animation
|
- [X] some level celebration/animation
|
||||||
|
|
||||||
* Installation and Development
|
* Installation and Development
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ asset_files = \
|
||||||
assets/images/glamshot.png \
|
assets/images/glamshot.png \
|
||||||
assets/levels/level1.tmx \
|
assets/levels/level1.tmx \
|
||||||
assets/levels/tiles.tsx \
|
assets/levels/tiles.tsx \
|
||||||
assets/levels/level-1.map
|
assets/levels/level-001.map
|
||||||
|
|
||||||
nobase_dist_pkgdata_DATA = $(asset_files)
|
nobase_dist_pkgdata_DATA = $(asset_files)
|
||||||
|
|
||||||
|
|
|
@ -21,37 +21,53 @@
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:export (launch-game))
|
#:export (launch-game))
|
||||||
|
|
||||||
|
(define levels #f)
|
||||||
(define level #f)
|
(define level #f)
|
||||||
(define repl #f)
|
(define repl #f)
|
||||||
(define hero #f)
|
(define hero #f)
|
||||||
(define others #f)
|
(define others #f)
|
||||||
(define keys #f)
|
(define keys #f)
|
||||||
(define inputs '())
|
(define inputs '())
|
||||||
|
(define has-won? #f)
|
||||||
|
|
||||||
(define (load)
|
(define (load)
|
||||||
(assets-load)
|
(assets-load)
|
||||||
(render-level-load)
|
(render-level-load)
|
||||||
(set! level (level-parse-file "assets/levels/level-1.map"))
|
(set! levels (assets-map-levels level-parse-file))
|
||||||
|
(load-level)
|
||||||
|
(set! repl (spawn-coop-repl-server)))
|
||||||
|
|
||||||
|
(define (load-level)
|
||||||
|
(set! level (car levels))
|
||||||
|
(set! levels (cdr levels))
|
||||||
(render-level-set! level)
|
(render-level-set! level)
|
||||||
(set! hero (hero-load level))
|
(set! hero (hero-load level))
|
||||||
(set! others (other-load-others level))
|
(set! others (other-load-others level))
|
||||||
(set! keys (keys-load level))
|
(set! keys (keys-load level))
|
||||||
(set! repl (spawn-coop-repl-server)))
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
(define (update dt)
|
(define (update dt)
|
||||||
(poll-coop-repl-server repl)
|
(poll-coop-repl-server repl)
|
||||||
(set! hero (hero-update hero level inputs keys dt))
|
(set! hero (hero-update hero level inputs keys dt))
|
||||||
(set! others (map (lambda (other) (other-update other level hero others dt)) others))
|
(set! others (map (lambda (other) (other-update other level hero others dt)) others))
|
||||||
(set! keys (keys-update keys hero))
|
(set! keys (keys-update keys hero))
|
||||||
|
(if (level-same-cell? (hero-position hero) (level-find-goal level))
|
||||||
|
(if (null? levels)
|
||||||
|
(set! has-won? #t)
|
||||||
|
(load-level)))
|
||||||
)
|
)
|
||||||
|
|
||||||
(define (draw _alpha)
|
(define (render-level)
|
||||||
(render-level-draw level)
|
(render-level-draw level)
|
||||||
(for-each render-other others)
|
(for-each render-other others)
|
||||||
(render-keys keys (level-find-goal level))
|
(render-keys keys (level-find-goal level))
|
||||||
(render-hero hero)
|
(render-hero hero))
|
||||||
)
|
|
||||||
|
(define (draw _alpha)
|
||||||
|
(if has-won?
|
||||||
|
(render-victory)
|
||||||
|
(render-level)))
|
||||||
|
|
||||||
(define (set-add set item)
|
(define (set-add set item)
|
||||||
(if (member item set)
|
(if (member item set)
|
||||||
|
|
|
@ -156,8 +156,8 @@
|
||||||
(test-equal (parse-tile #\G) 'goal)
|
(test-equal (parse-tile #\G) 'goal)
|
||||||
(test-equal (parse-tile #\space) 'empty)
|
(test-equal (parse-tile #\space) 'empty)
|
||||||
|
|
||||||
(test-equal (level-width (level-parse-file "assets/levels/level-1.map")) 40)
|
(test-equal (level-width (level-parse-file "assets/levels/level-001.map")) 40)
|
||||||
(test-equal (level-height (level-parse-file "assets/levels/level-1.map")) 30)
|
(test-equal (level-height (level-parse-file "assets/levels/level-001.map")) 30)
|
||||||
|
|
||||||
(test-equal
|
(test-equal
|
||||||
(level-tile-at-row-col (level-parse "WWWWW\nWP GW\nWWWWW\n") 1 1)
|
(level-tile-at-row-col (level-parse "WWWWW\nWP GW\nWWWWW\n") 1 1)
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
#:use-module (chickadee graphics color)
|
#:use-module (chickadee graphics color)
|
||||||
#:use-module (chickadee graphics sprite)
|
#:use-module (chickadee graphics sprite)
|
||||||
#:use-module (chickadee graphics texture)
|
#:use-module (chickadee graphics texture)
|
||||||
|
#:use-module (chickadee graphics text)
|
||||||
#:use-module (chickadee math vector)
|
#:use-module (chickadee math vector)
|
||||||
#:export (render-level-load
|
#:export (render-level-load
|
||||||
render-level-draw
|
render-level-draw
|
||||||
render-level-set!
|
render-level-set!
|
||||||
|
render-victory
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +59,9 @@
|
||||||
(draw-sprite-batch sprite-batch))
|
(draw-sprite-batch sprite-batch))
|
||||||
|
|
||||||
|
|
||||||
|
(define (render-victory)
|
||||||
|
(draw-sprite (load-image (assets-file-name "assets/images/victory.jpg")) (vec2 0 0)))
|
||||||
|
|
||||||
(test-begin "tile translation")
|
(test-begin "tile translation")
|
||||||
|
|
||||||
(test-equal (level-tile-index 'empty) 3800)
|
(test-equal (level-tile-index 'empty) 3800)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
(define-module (game util assets)
|
(define-module (game util assets)
|
||||||
|
#:use-module (ice-9 ftw)
|
||||||
|
#:use-module (ice-9 textual-ports)
|
||||||
#:use-module (chickadee graphics texture)
|
#:use-module (chickadee graphics texture)
|
||||||
#:use-module (chickadee graphics color)
|
#:use-module (chickadee graphics color)
|
||||||
#:export (assets-load assets-file-name tile-texture tile-atlas hero-texture hero-atlas)
|
#:export (assets-load assets-file-name tile-texture tile-atlas hero-texture hero-atlas assets-map-levels)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,6 +20,16 @@
|
||||||
(string-append prefix "/" name)
|
(string-append prefix "/" name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(define (read-level-map filename)
|
||||||
|
(call-with-input-file get-string-all))
|
||||||
|
|
||||||
|
(define (assets-map-levels f)
|
||||||
|
(map f
|
||||||
|
(map (lambda (filename)(string-append prefix "/assets/levels/" filename))
|
||||||
|
(scandir (assets-file-name "assets/levels")
|
||||||
|
(lambda (filename) (string-suffix? ".map" filename ))))))
|
||||||
|
|
||||||
(define (assets-load)
|
(define (assets-load)
|
||||||
(set! tile-texture (load-image (assets-file-name "assets/images/simples_pimples.png")
|
(set! tile-texture (load-image (assets-file-name "assets/images/simples_pimples.png")
|
||||||
#:transparent-color black))
|
#:transparent-color black))
|
||||||
|
|
Loading…
Reference in a new issue