diff --git a/Makefile b/Makefile index 1a39472..f93c513 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(shell for f in $(filter $(subst *,%,$2),$d); do [ -d "$$f" ] || printf "%s\n" "$$f"; done)) -PDXNAME = Explosionface +PDXNAME = Consoom! EXCLUDESOURCES = src/macros.fnl SOURCEFILES = $(filter-out $(EXCLUDESOURCES),$(call rwildcard, src, *.fnl)) OUTFILES = $(subst src,source,$(SOURCEFILES:.fnl=.lua) $(filter-out $(SOURCEFILES),$(call rwildcard, src, *))) diff --git a/art/Wrapping pattern template.ase b/art/Wrapping pattern template.ase new file mode 100644 index 0000000..970b6ca Binary files /dev/null and b/art/Wrapping pattern template.ase differ diff --git a/art/consume-card-raster.kra b/art/consume-card-raster.kra new file mode 100644 index 0000000..c0db121 Binary files /dev/null and b/art/consume-card-raster.kra differ diff --git a/art/consume-card-raster.png b/art/consume-card-raster.png new file mode 100644 index 0000000..dd5994b Binary files /dev/null and b/art/consume-card-raster.png differ diff --git a/art/consume-card.kra b/art/consume-card.kra new file mode 100644 index 0000000..d63f019 Binary files /dev/null and b/art/consume-card.kra differ diff --git a/src/cache.fnl b/src/cache.fnl index e7ad7d1..9e1fb01 100644 --- a/src/cache.fnl +++ b/src/cache.fnl @@ -29,7 +29,7 @@ value (. caches asset)] (if (not= value nil) value (let [{: constructor : initializer} (. cache.asset-lifecycles asset) - value (constructor)] + value (constructor type id)] (initializer value type id) (tset caches asset value) value)))) @@ -40,7 +40,7 @@ (when caches (each [asset value (pairs caches)] (let [{: destructor} (. cache.asset-lifecycles asset)] - (destructor value))) + (when destructor (destructor value)))) (tset cache.caches type ?id nil))) (let [?id-to-caches (. cache.caches type)] (when ?id-to-caches diff --git a/src/explosion.fnl b/src/consoom.fnl similarity index 91% rename from src/explosion.fnl rename to src/consoom.fnl index d323e4b..cc785c6 100644 --- a/src/explosion.fnl +++ b/src/consoom.fnl @@ -6,11 +6,11 @@ (local iter (require :meta.iter)) (local state (require :state)) (local cache (require :cache)) -(local {: make-image : defsprite : sprite : dirty : with-bg-draw : with-image : with-collision} (require :sprite)) +(local {: make-image : image : defsprite : sprite : dirty : with-bg-draw : with-image : with-collision} (require :sprite)) (local gfx playdate.graphics) -(local devmode true) +(local devmode false) (local update (defmulti #$1)) (local children (defmulti #$2)) @@ -49,11 +49,6 @@ (local screenw (playdate.display.getWidth)) (local screenh (playdate.display.getHeight)) -(let [bucketw 50 bucketh 10 radius 4 - xoffset (/ bucketw 2) - image (make-image bucketw bucketh #(gfx.drawRoundRect 0 0 bucketw bucketh radius))] - (defsprite :bucket #(doto $1 (with-image image 0.5 0.5) (with-collision 1 2)))) - (fn lose-life [ctx] (let [count ctx.bucket.count] (dec ctx.bucket :count) @@ -67,9 +62,12 @@ (let [crank (playdate.getCrankPosition) ratio (if (> crank 180) (/ (- 360 crank) -130) (/ crank 130)) x (* (/ (+ ratio 1) 2) screenw)] - (for [ibucket 1 bucket.count] - (let [buckety (+ 190 (* (- ibucket 1) 20))] - (doto (sprite :bucket ibucket) (: :moveTo x buckety))))))) + (if (> bucket.count 0) + (doto (sprite :bucket) + (with-image (image :gfx/mouth (math.min bucket.count 3)) 0.5 0) + (with-collision 1 2) + (: :moveTo x 190)) + (doto (sprite :bucket) (with-image nil 0.5 0)))))) (let [image (make-image 20 30 #(gfx.fillRoundRect 0 0 20 30 6))] (defsprite :bomber #(with-image $1 image 0.5 0))) @@ -113,6 +111,7 @@ (when (and (= ctx.state :bombing) (= bomber.bombs-left 0) (= (length ctx.bombs) 0)) (inc ctx :level) + (set ctx.bucket.count 3) (dirty :background) (set ctx.state :waiting)) diff --git a/src/gfx/mouth-table-1.png b/src/gfx/mouth-table-1.png new file mode 100644 index 0000000..c938a9e Binary files /dev/null and b/src/gfx/mouth-table-1.png differ diff --git a/src/gfx/mouth-table-2.png b/src/gfx/mouth-table-2.png new file mode 100644 index 0000000..db445b5 Binary files /dev/null and b/src/gfx/mouth-table-2.png differ diff --git a/src/gfx/mouth-table-3.png b/src/gfx/mouth-table-3.png new file mode 100644 index 0000000..1180c2b Binary files /dev/null and b/src/gfx/mouth-table-3.png differ diff --git a/src/launcher/card.png b/src/launcher/card.png new file mode 100644 index 0000000..9ed95c2 Binary files /dev/null and b/src/launcher/card.png differ diff --git a/src/main.fnl b/src/main.fnl index f465dbb..aae10dd 100644 --- a/src/main.fnl +++ b/src/main.fnl @@ -5,4 +5,4 @@ (import :package) (require :meta.reload) -(require :explosion) +(require :consoom) diff --git a/src/pdxinfo b/src/pdxinfo index 605da10..7a20c02 100644 --- a/src/pdxinfo +++ b/src/pdxinfo @@ -1,5 +1,6 @@ -name=Explosionface +name=Consoom! author=Jeremy Penner -description=Keep the world from exploding! -bundleID=com.glorioustrainwrecks.explosionface -buildNumber=1 +description=Eat! Eat all the things! Eat forever!! +bundleID=com.glorioustrainwrecks.consoom +buildNumber=2 +imagePath=launcher diff --git a/src/sprite.fnl b/src/sprite.fnl index 5afd4ab..4e9fc0e 100644 --- a/src/sprite.fnl +++ b/src/sprite.fnl @@ -2,6 +2,8 @@ (import :CoreLibs/sprites) (cache.register-asset :sprite #(doto (playdate.graphics.sprite.new) (: :add) (: :setUpdatesEnabled false)) #($1:remove)) +(cache.register-asset :image #(playdate.graphics.image.new $1)) +(cache.register-asset :imagetable #(playdate.graphics.imagetable.new $1)) (local gfx playdate.graphics) @@ -30,4 +32,11 @@ (doto spr (: :setGroupMask groupmask) (: :setCollidesWithGroupsMask collidemask) (: :setCollideRect (if ?colliderect ?colliderect (values 0 0 (spr:getSize)))))) -{: make-image : defsprite : sprite : dirty : with-image : with-collision : with-draw : with-bg-draw} +(fn image [filename ?i ?y] + (if (not= ?y nil) + (: (cache.get :imagetable filename) :getImage ?i ?y) + (not= ?i nil) + (: (cache.get :imagetable filename) :getImage ?i) + (cache.get :image filename))) + +{: make-image : image : defsprite : sprite : dirty : with-image : image : with-collision : with-draw : with-bg-draw}