some level tweaks

This commit is contained in:
Peter Tillemans 2024-05-27 13:06:56 +02:00
parent 557f179667
commit e992bd986f
7 changed files with 56 additions and 25 deletions

View file

@ -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!
* Game Plan [20/22]
* Game Plan [20/25]
- [X] start project organization
- [X] select some assets to start with
@ -60,6 +60,9 @@ So now, go out, collect the keys and maintain a healthy diet!
- [X] add foods and bloat indicator
- [X] scale hero waist related to bloat level
- [X] create more levels
- [ ] slow down if hungry or had too much to eat
- [ ] add more text to explain things
- [ ] add text bubbles with unhelpful comments
- [ ] dig potholes
- [ ] make others steal keys
- [X] some level celebration/animation
@ -79,7 +82,7 @@ Untar the filename, enter the newly created folder and launch `bloatrunner/bloat
#+END_SRC
*** TODO make an upload script which cleans up the filename
*** DONE make an upload script which cleans up the filename
The current filename contains the GUIX UUID which is ugly and not very
userfriendly.
@ -163,7 +166,7 @@ $ watchexec -e .scm ./pre-inst-env bloatrunner
```
** TODO Bundling
** DONE Bundling
Use `guix pack`.
@ -257,6 +260,12 @@ the environment variables set according to the installed environment.
most of this is dynamically construct the content of the paths.
** Publishing to Itch.io
The autoconf also creates a `publish` script to create a distribution
and upload to itch.io.
* Asset Dependencies
** Hero sprites

View file

@ -5,7 +5,7 @@
WWWWWGWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
W H W
W O H O W
W H K F K f K F F H W
W H K K F K F H W
W O BBBBBBBBBBBBBBBBBBBBBBBBBBHB O W -
W H W
W H W

View file

@ -5,15 +5,15 @@
WWWWWWWWWWWWWWWWWWWGWWWWWWWWWWWWWWWWWWWW
W H W
W O H O W
W H K H K H W
W H F K F H K F H W
W O BHBBBBBBBBBBBBBBBBBBBBBBBBH O W -
W HH H W
W HHH H W
W HHHH H H W
W BBBBHHHH BBBBBBBHB W
W BBBHHHH BBBBBBBHB W
W HHHH HHHH W -
W HHHH HHHH W
W H K HHHHHHHHHHHH HHHH W
W H K HHHHHHHHHHHH F f HHHH W
W BHBBBB HHHHHHHHHHHHHHHHHHHH W
W H HH W
W H HH W -
@ -21,7 +21,7 @@ W H HH W
W H HH W
W H H W
W H H W
W H H H K H W -
W H H H KFFH W -
W BBBBBBBBBHB P BHBBBBBBB W
W H H W
W H H W
@ -29,6 +29,6 @@ W H H W
W BHBBBBBBBBBBBHB W -
W H H W
W H H W
W H K H W
W H F K f H W
WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW -

View file

@ -55,16 +55,16 @@
"return the current position of the hero"
(runner-position (hero-runner hero)))
(define (clamp lower upper x)
"return x clamped to the given lower and upper bounds"
(min upper (max lower x)))
(define (hero-bloat hero)
"return the current bloat of the hero clamped to 0.5 and 2.0"
(let* ((calories (- (hero-eaten hero) (hero-exercise hero)))
(raw-bloat (+ 1.0 (/ calories 2000.0)))
)
(cond
((< calories -1000) 0.5)
((> calories 1000) 2.0)
(else raw-bloat)
)))
(clamp 0.5 2.0 raw-bloat)))
(define (collides? a b)
"return true if the position collides with the given position"
@ -83,12 +83,12 @@
(define moving-exercise 0.2)
(define (calculate-exercise hero new-position)
"return the calories burned for the hero moving to the new position"
(let ((movement (vec2- new-position (hero-position hero))))
(+
(if (> (vec2-y movement) 0) climbing-exercise 0)
(if (not (zero? (vec2-x movement))) moving-exercise 0))))
(define (hero-update hero level inputs keys calories-eaten dt)
(let* ((new-runner (runner-update (hero-runner hero) level inputs dt))
(new-runner (if (blocked-by-door?
@ -131,6 +131,10 @@
(test-assert (not (blocked-by-door? level '(dummy-key) (vec2- goal-position (vec2 0 -16)) 1.0)))
(test-assert (blocked-by-door? level '() goal-position 1.55))
(test-equal 0.5 (clamp 0.5 2.0 0.0 ))
(test-equal 1.5 (clamp 0.5 2.0 1.5))
(test-equal 2.0 (clamp 0.5 2.0 2.5))
)
(test-end "hero-model")

View file

@ -80,12 +80,12 @@
(define (render-victory)
(draw-sprite (assets-load-image "victory.jpg") (vec2 0 0)))
(draw-sprite victory-image (vec2 0 0)))
(define (render-defeat)
(draw-sprite (assets-load-image "defeat.jpg") (vec2 0 0)))
(draw-sprite defeat-image (vec2 0 0)))
(test-begin "tile translation")
(test-begin "tile-translation")
(test-equal (level-tile-index 'empty) empty-index)
(test-equal (level-tile-index 'brick) 3750)
@ -94,4 +94,4 @@
(test-equal (level-tile-index 'goal) empty-index)
(test-equal (level-tile-index 'unknown) 3326)
(test-end "tile translation")
(test-end "tile-translation")

View file

@ -3,7 +3,18 @@
#:use-module (ice-9 textual-ports)
#:use-module (chickadee graphics texture)
#:use-module (chickadee graphics color)
#:export (assets-load assets-load-image tile-texture tile-atlas hero-texture hero-atlas assets-map-levels read-level-map)
#:export (
assets-load
assets-load-image
tile-texture
tile-atlas
hero-texture
hero-atlas
assets-map-levels
read-level-map
defeat-image
victory-image
)
)
@ -13,6 +24,9 @@
(define hero-texture #f)
(define hero-atlas #f)
(define defeat-image #f)
(define victory-image #f)
(define (assets-location)
"find the location of the assets directory. The location is specified
by the ASSET_DIR environment variable, or defaults to 'assets' in the
@ -58,4 +72,8 @@
(set! tile-atlas (split-texture tile-texture 16 16))
(set! hero-texture (assets-load-image "lr_penguin2.png"))
(set! hero-atlas (split-texture hero-texture 32 32)))
(set! hero-atlas (split-texture hero-texture 32 32))
(set! defeat-image (assets-load-image "defeat.jpg"))
(set! victory-image (assets-load-image "victory.jpg"))
)

View file

@ -24,7 +24,7 @@ if [ -f "$SOURCETAR" ]; then
if [ -f $TARBALL ]; then
TARGETNAME=/tmp/bloatrunner
echo unpack $TARBALL to $TARGETNAME
rm -f $TARGETNAME
rm -rf $TARGETNAME
mkdir -p $TARGETNAME
tar -xzvf $TARBALL -C $TARGETNAME