From eb9860c2a73709dfd8e01fc71388decfe497878b Mon Sep 17 00:00:00 2001 From: skwok707 Date: Sun, 29 Dec 2024 17:55:53 +1100 Subject: [PATCH 1/2] Sprig App - Blocky --- games/Blocky.js | 236 +++++++++++++++++++++++++++++++++++++++++++ games/img/Blocky.png | Bin 0 -> 8002 bytes 2 files changed, 236 insertions(+) create mode 100644 games/Blocky.js create mode 100644 games/img/Blocky.png diff --git a/games/Blocky.js b/games/Blocky.js new file mode 100644 index 0000000000..b1f45160ea --- /dev/null +++ b/games/Blocky.js @@ -0,0 +1,236 @@ +const player = "p"; +const box = "b"; +const goal = "g"; +const wall = "w"; +const spike = "z"; + +// assign bitmap art to each sprite +setLegend( + [ player, bitmap` +................ +...0000000000... +...0444444440... +...0433343330... +...0444444440... +...0444444440... +...0000440000... +......00000..... +...00004440..... +...04044440..... +...04044440..... +...04044440..... +...04044440..... +...00000000..... +.....040040..... +.....000000.....`], + [ box, bitmap` +................ +................ +................ +...66666666666.. +...66666606666.. +...60000000006.. +...60666606666.. +...60000000006.. +...66666606606.. +...66666606606.. +...60000000006.. +...66666606666.. +...66666666666.. +...66666666666.. +................ +................`], + [ goal, bitmap` +....00000000.... +...0066666600... +...0666666660... +..006666666600.. +.00666666666600. +.00000000000000. +.03333333333330. +.03003333333330. +.03003333333330. +.03333000003330. +.033330FFF03330. +.033330FFF03330. +.033330FFF03330. +.033330FFF03330. +.00000000000000. +................`], + [ wall, bitmap` +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000`], + [ spike, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +.......3........ +......333....... +......333....... +.....33333...... +....3333333..... +....3333333..... +...333333333.... +................`] +); + + +let level = 0; +const levels = [ + map` +.....g +.b.p.. +...... +...... +......`, + map` +....g +...b. +p.... +..... +.....`, + map` +.......www +.www.w.... +w..w..www. +w..ww.w... +ww.ww.www. +ww.wwbw... +ww.w.gw.ww +w..wwww..w +p.......ww +wwwwww.www`, + map` +..... +pb... +ww... +..... +...g.`, + map` +zzz +zpz +zzz`, + map` +...www.. +p..b.... +.....w.. +.ww..... +.wg..w..`, + map` +w...... +pb.ww.. +w.....w +gwwww.w +.w....w +.w..... +...w.w. +....... +w......`, + map` +...w... +.....ww +.b.w.wg +..pw.w. +w.ww... +....... +.......`, + map` +wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww +w....................................w +w....................................w +w....................................w +w....................................w +w....................................w +w....................................w +wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww +g..................................... +wwww.w.www.w...ww..wwwww.wwwwwww.www.. +.w.w.w.w.w.ww..ww.w.w....w..w..w.w.w.. +.w.www.www.w.wwwww..wwww.wwww..w.www.. +.w.w.www.www..www.w....w.w..w..w.w.w.. +.w.w.ww...ww...ww..wwwww.w..wwww.w..w. +...................................... +.wwww.....w.ww...wwwwww..w.wwww..w.... +.w.ww....www..w.w..w.www.w.w.....w.... +.wwww...ww.ww..w...w.w.wwww......w.... +.w..w...wwwww..w...w.w.wwww..www...... +.w..w...w...w..w...w.w...www..w..w.... +.w..wwwww...w..w..wwww...w.wwww....... +...................................... +.pb..................................w +.....................................w` +]; + + +const currentLevel = levels[level]; +setMap(currentLevel); + +setSolids([ player, box, wall ]); + +setPushables({ + [player]: [box], + [box]: [ box ], +}); + +onInput("s", () => { + getFirst(player).y += 1; +}); + +onInput("d", () => { + getFirst(player).x += 1; +}); + +onInput("w", () => { + getFirst(player).y += -1; +}); + +onInput("a", () => { + getFirst(player).x += -1; +}); + +onInput("j", () => { + const currentLevel = levels[level]; + + if (currentLevel !== undefined) { + clearText(""); + setMap(currentLevel); + } +}); + + +afterInput(() => { + const targetNumber = tilesWith(goal).length; + + const numberCovered = tilesWith(goal, box).length; + + if (numberCovered === targetNumber) { + level = level + 1; + + const currentLevel = levels[level]; + + if (currentLevel !== undefined) { + setMap(currentLevel); + } else { + addText("Good Job!", { y: 4, color: color`3` }); + } + } +}); \ No newline at end of file diff --git a/games/img/Blocky.png b/games/img/Blocky.png new file mode 100644 index 0000000000000000000000000000000000000000..11e3bc280a5ce24ecd6542879abeac04fea97fb8 GIT binary patch literal 8002 zcmeHMYgm(4y8Tcbt+rr0BOa`PQ^rm!0@HF7X%Z;5h}sHP%Eg2PF9)MUgC-In;bNUL zL#qgNjzAqCsAvUa5)nd7xWpM0I7ae$A&G&6Xd^@j0cl9WEo64W9Z|8T&ad->hlf0T z+24Nmde^(w+TU#r3VdtfvV{-?y|roM=i4A?4hj4mTksq339q~S5%^_8-WIqXVu_Zw zgFkHX{#*PZs3ddI(9U__?>7!^+)jodyBf=nOTe( zYU-{nEij~-``9X3qI=z{a_8U(f$tyE1G*cD{)H~uLia2{TaEO%fg)WwPzBfgv_s*wfD*Q+tM$peVYo20YYh$ z4tblYaF&Mkeqzrd2C6e=cVd?Hi$W=sgsN&sSfq(t`DB--$Jx2yuPRBL+dcK!I4xCs z@{%}#N^HslRScvxGWYhQY4kK6r&-l>45vOT(LRx%d=4IF*d6DV$j%tg1(>K}*<$yj zTH0F^Uk4~g@Yvb;)QU%`X7in!5)}&R`_}73MprknZX6l+g}Q@sJ~3bbS;oS$QQJ7n zg5fQ>UUd54-c0@y_b39a`xBQ!i^Sa3ARGBk`H1m0nxSmgZbL_dj({ZAvn>kks;|N+ z)A4FO|DD4n`ULyT;F?1k{*rdx9X_SXuu&XSiRLPY2bFIIwhfw7z0wMsus=$eQUMty zFsg_1UwnN0g{1KCaF>)6qr%hAbb6qwxS&{>KX7_LQCwgY%!jV5oCajZ>IF%u@d$dp zH|L46k-W#;?_#DRH9~X0y_tZd=~{({KlH;qd}_gQj^x1Rf%O?T^Lo%yBB%u>GhDOh zt7hT$#R;d;T%1{?A8IKWj3;Ii+^G3!Xl@}n@LB3PHgvVdJme`@27Bnd&8lFPEce20 zQ>)*QDZ#LZ?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_lP2>L>><%C1?JQTubl? zd)5QY1dr$P%j?C+OYQ(bAe?0qibD;0d9Kgyc3x|nAreMyyY0wsjd+e9npQlk8U|NG z{{bD*TW@$`vJj+EWD?uI0yhuOBJ=+m(2t(lil>l1Kgbs3)JHSKfw?%UquQA2*W9f-AkpWj1+ Qdv9n{K+xx`^*fIK3nd;NegFUf literal 0 HcmV?d00001 From ddc2222b7c543492e14000d038ab8e303735fb41 Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 2 Jan 2025 10:35:51 -0500 Subject: [PATCH 2/2] Fixing metadata --- games/Blocky.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/games/Blocky.js b/games/Blocky.js index b1f45160ea..48bf45423c 100644 --- a/games/Blocky.js +++ b/games/Blocky.js @@ -1,3 +1,9 @@ +/** +@title: Blocky +@author: skwok707 +@tags: [] +@addedOn: 2025-01-02 +*/ const player = "p"; const box = "b"; const goal = "g"; @@ -233,4 +239,4 @@ afterInput(() => { addText("Good Job!", { y: 4, color: color`3` }); } } -}); \ No newline at end of file +});