From 0326c0c2ca2cbf20ccd67dddbb7237a5d37381b3 Mon Sep 17 00:00:00 2001 From: potato dog man Date: Thu, 20 Jun 2024 23:46:55 +0800 Subject: [PATCH 01/12] Add files via upload --- games/racing game.js | 200 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 games/racing game.js diff --git a/games/racing game.js b/games/racing game.js new file mode 100644 index 0000000000..ec6da98f89 --- /dev/null +++ b/games/racing game.js @@ -0,0 +1,200 @@ +/* +@title: car_race +@tags: ['strategy'] +@addedOn: 2024-06-20 +@by : saumil +about : collect all green stuff (grass) and go to the blue thing(the destination) +*/ + +const car = 'c'; +const destination = 'd'; +const obstacle = 'o'; +const road = 'r'; +const grass = 'g'; +const player = 'p'; + +setLegend( + [car, bitmap` +................ +.....44444...... +...44.....44.... +..4.........4... +.4....4.4....4.. +4....44444....4. +4....4.4.4....4. +4...4444444...4. +4...4.4.4.4...4. +4..444444444..4. +.4.4.4.4.4.4.4.. +..4.........4... +...44.....44.... +.....44444...... +................`], + [destination, bitmap` +................ +.....55555...... +...55.....55.... +..5.........5... +.5....5.5....5.. +5....55555....5. +5....5.5.5....5. +5...5555555...5. +5...5.5.5.5...5. +5..555555555..5. +.5.5.5.5.5.5.5.. +..5.........5... +...55.....55.... +.....55555...... +................`], + [obstacle, bitmap` +................ +.....11111...... +...11.....11.... +..1.........1... +.1....1.1....1.. +1....11111....1. +1....1.1.1....1. +1...1111111...1. +1...1.1.1.1...1. +1..111111111..1. +.1.1.1.1.1.1.1.. +..1.........1... +...11.....11.... +.....11111...... +................`], + [grass, bitmap` +..4.........4... +...4.........4.. +...44........4.. +....4.........4. +....44........4. +.....4........4. +.....44......4.. +.....44...4..... +.....444...4.... +4.....44....4... +.4....44....4... +.4...444.....4.. +.4...44......4.. +.4...........4.. +4...........4... +................`], + [road, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................`], + [player, bitmap` +................ +................ +.....00000...... +....0.....0..... +...0.0.0.0.0.... +..0...000...0... +..0....0....0... +..0...000...0... +..0.0.0.0.0.0... +....0.....0..... +.....00000...... +................ +................ +................ +................`] +) + +setSolids([player, obstacle, car]); +setPushables({ + [player]: [] }); + +let level = 0; +const levels = [ + map` +pgr +gor +ggd`, + map` +pgggr +gorod +gggrr`, + map` +pgogd +..gor +gorgr`, + map` +gooogg +..o..g +gggggg +g.d.gg +g...gg +ggp.gg`, + map` +gggggg +goooog +gpgggd +gororr`, + map` +g........ +g..g.g.p. +g.gg.gg.. +.gg...g.. +..o...go. +......oo. +..ooooo.. +..od..... +ggggggggg` +]; + +setMap(levels[level]); + +const pushPlayer = (dx, dy) => { + const playerTile = getFirst(player); + if (playerTile) { + const newX = playerTile.x + dx; + const newY = playerTile.y + dy; + if (newX >= 0 && newX < width() && newY >= 0 && newY < height()) { + const targetTile = getTile(newX, newY); + if (!targetTile.some(tile => tile.type === obstacle) && !targetTile.some(tile => tile.type === car)) { + clearTile(playerTile.x, playerTile.y); + addSprite(newX, newY, player); + + if (targetTile.some(tile => tile.type === destination)) { + setTimeout(() => { + level++; + if (level < levels.length) { + setMap(levels[level]); + } else { + addText("You win!", { y: 6, color: color`3` }); + } + }, 200); + } + } + } + } +}; + +onInput('a', () => pushPlayer(-1, 0)); +onInput('d', () => pushPlayer(1, 0)); +onInput('w', () => pushPlayer(0, -1)); +onInput('s', () => pushPlayer(0, 1)); + +afterInput(() => { + // Remove destination tile when player reaches it + for (const { x, y } of getAll(player)) { + for (const d of getTile(x, y).filter(tile => tile.type === destination)) { + d.remove(); + } + } +}); \ No newline at end of file From f2569e95f81ea96e6e53bc3a7ff9abcfd84cd030 Mon Sep 17 00:00:00 2001 From: potato dog man Date: Thu, 20 Jun 2024 23:52:08 +0800 Subject: [PATCH 02/12] Update and rename racing game.js to racing_game.js --- games/{racing game.js => racing_game.js} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename games/{racing game.js => racing_game.js} (99%) diff --git a/games/racing game.js b/games/racing_game.js similarity index 99% rename from games/racing game.js rename to games/racing_game.js index ec6da98f89..cac39524ff 100644 --- a/games/racing game.js +++ b/games/racing_game.js @@ -1,5 +1,5 @@ /* -@title: car_race +@title: racing_game_shrek @tags: ['strategy'] @addedOn: 2024-06-20 @by : saumil @@ -197,4 +197,4 @@ afterInput(() => { d.remove(); } } -}); \ No newline at end of file +}); From 9ac935352d65f0ff24b4f1cb7fda3d148ce14aba Mon Sep 17 00:00:00 2001 From: Mare Cosmin <147330889+Cosmin-Mare@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:33:19 -0400 Subject: [PATCH 03/12] Change @by to @author --- games/racing_game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games/racing_game.js b/games/racing_game.js index cac39524ff..6930f78269 100644 --- a/games/racing_game.js +++ b/games/racing_game.js @@ -2,7 +2,7 @@ @title: racing_game_shrek @tags: ['strategy'] @addedOn: 2024-06-20 -@by : saumil +@author: saumil about : collect all green stuff (grass) and go to the blue thing(the destination) */ From df09181bb79bcc2c6ea80aa2b1da491dd7559c1d Mon Sep 17 00:00:00 2001 From: potato dog man Date: Fri, 21 Jun 2024 10:55:05 +0800 Subject: [PATCH 04/12] Update racing_game.js --- games/racing_game.js | 60 ++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/games/racing_game.js b/games/racing_game.js index 6930f78269..d7fee63970 100644 --- a/games/racing_game.js +++ b/games/racing_game.js @@ -1,9 +1,9 @@ /* -@title: racing_game_shrek +@title: car_race @tags: ['strategy'] @addedOn: 2024-06-20 -@author: saumil -about : collect all green stuff (grass) and go to the blue thing(the destination) +@by : saumil +about : collect all green stuff (grass) and go to the blue thing(the destination) */ const car = 'c'; @@ -113,11 +113,12 @@ setLegend( ................ ................ ................`] -) +); setSolids([player, obstacle, car]); setPushables({ - [player]: [] }); + [player]: [] +}); let level = 0; const levels = [ @@ -157,7 +158,14 @@ g.gg.gg.. ggggggggg` ]; -setMap(levels[level]); +let destinationPosition = null; + +const setLevel = (lvl) => { + setMap(levels[lvl]); + destinationPosition = getFirst(destination); // Save the destination position +} + +setLevel(level); const pushPlayer = (dx, dy) => { const playerTile = getFirst(player); @@ -169,17 +177,29 @@ const pushPlayer = (dx, dy) => { if (!targetTile.some(tile => tile.type === obstacle) && !targetTile.some(tile => tile.type === car)) { clearTile(playerTile.x, playerTile.y); addSprite(newX, newY, player); + } + } + } +}; - if (targetTile.some(tile => tile.type === destination)) { - setTimeout(() => { - level++; - if (level < levels.length) { - setMap(levels[level]); - } else { - addText("You win!", { y: 6, color: color`3` }); - } - }, 200); - } +const checkDestination = () => { + const playerTile = getFirst(player); + if (playerTile) { + const targetTile = getTile(playerTile.x, playerTile.y); + if (targetTile.some(tile => tile.type === destination)) { + if (getAll(grass).length === 0) { // Check if all grass is collected + setTimeout(() => { + level++; + if (level < levels.length) { + setLevel(level); + } else { + addText("You win!", { y: 6, color: color`3` }); + } + }, 200); + } else { + addText("Collect all grass!", { y: 15, color: color`3`, duration: 0.5 }); + addText("Press J to Reset", { y: 1, color: color`3`, duration: 0.5 }); + addSprite(destinationPosition.x, destinationPosition.y, destination); } } } @@ -189,12 +209,8 @@ onInput('a', () => pushPlayer(-1, 0)); onInput('d', () => pushPlayer(1, 0)); onInput('w', () => pushPlayer(0, -1)); onInput('s', () => pushPlayer(0, 1)); +onInput('j', () => setLevel(level)); // Reset the current level when 'j' is pressed afterInput(() => { - // Remove destination tile when player reaches it - for (const { x, y } of getAll(player)) { - for (const d of getTile(x, y).filter(tile => tile.type === destination)) { - d.remove(); - } - } + checkDestination(); }); From d527fcc8eb53b78a238d96fc80c5312125becf98 Mon Sep 17 00:00:00 2001 From: graham Date: Fri, 21 Jun 2024 10:37:32 -0400 Subject: [PATCH 05/12] Fixing metadata --- games/racing_game.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/games/racing_game.js b/games/racing_game.js index d7fee63970..2364b51101 100644 --- a/games/racing_game.js +++ b/games/racing_game.js @@ -1,9 +1,10 @@ /* -@title: car_race +@title: Car Race @tags: ['strategy'] @addedOn: 2024-06-20 -@by : saumil -about : collect all green stuff (grass) and go to the blue thing(the destination) +@author: saumil + +Collect all green stuff (grass) and go to the blue thing (the destination) */ const car = 'c'; From e4b30b24da59f6542c48526c9028df188a32a69e Mon Sep 17 00:00:00 2001 From: Graham Darcey Date: Fri, 21 Jun 2024 10:47:30 -0400 Subject: [PATCH 06/12] Adding screenshot so gallery looks ok --- games/img/racing_game.png | Bin 0 -> 5085 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 games/img/racing_game.png diff --git a/games/img/racing_game.png b/games/img/racing_game.png new file mode 100644 index 0000000000000000000000000000000000000000..c0e3222298106d67e7ce964de7ed7b6f4b833a1a GIT binary patch literal 5085 zcma)A2Ut_twmvy?(BOcErZl;kU_eT!ih{r#ic~@AT~P!>2|;QQl*Dm@NO_JI0Sl4~ ziV7rSArwJi20;ZIML-ZFB3Kv&MVbS{TR2Yn#yj&K-*>*VID753*1!J!@1$*Wwv}9_ zxC}uMNqakMR|FxLE$-fltB!NHL+bY|>P zoT~>NyF%T)W4)cWm;^ByIy-kWcLnRP7*UH|5L1>3n2g}qon#gxA~ME=Wk&hvVFLEz zXI%>Uqf2bK8O7Ua8`+8(9ZWXT(bLhRm@gxf$)?e}Lrh$)Z9a8}|I8@#*w`o&UEPF) z1f2v!9cJ_%U43I?V_iK1T>}Fec+g@JBV%{6Xpu3hzYg--IM%^2LD8X6v7yXJ^5VEV zcQNB)%_x+`iGKh4b)CVi&_8C1jQO-J*r4uWi>|(op6>5sLs!$quO{0Pw&6&`KOk@_VkDej<#YlV9HqYKQi-a+CMjb>S(IFxbr_n z;@2>L{0eb4UuLTNd(O<44WGzSLJ%oidut1K7U6Zj#j(}KQpmOqB2|*M2pb`e=tX$% zmG_L;DB(4@B*Z={wOB5zc__=_p>AfKCiQy#<(d-rmSmrQyT}|%sjscuZ$7K7K7KQ0 zLF3N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#JzEqCiU=wB(&zx3)HgtK@jyV$DE0{u&@O`e^aoTRfE zL|e_T|D`m!Ny_H#L`?kXoa}63bN9u!MJHH|N$xFi7;%d(Pvo@2QXI7K1<1vP>{0mL zVLKdhb%&$@9WKCpE*jmSnXZ34Cq8Je!9mb2g-eGS`xy{!7t}%5g(7YE4FGgb5^|dg z5*RKbd>30E7!xjc)5tML&_h;04@Fs5U`zsMf$&RDv4`H1eZ0k=#_TscTMH}$5B@LM C<9G`I literal 0 HcmV?d00001 From 7eb6688cd1d075779ef038c4bb3837557b8140b4 Mon Sep 17 00:00:00 2001 From: potato dog man Date: Sat, 9 Nov 2024 08:41:47 +0800 Subject: [PATCH 07/12] Update index.astro --- src/pages/index.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 55b489056b..b9f89a59bc 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -259,7 +259,7 @@ if (session && session.session.full) {
»

3

-

Check your mailbox for a Sprig device :)

+

Check your mailbox for a Sprig :)

From f01f5cf1aa9fa87bcd564e6fbe14e98ab857c861 Mon Sep 17 00:00:00 2001 From: potato dog man Date: Sat, 9 Nov 2024 08:59:25 +0800 Subject: [PATCH 08/12] Update index.astro --- src/pages/index.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index b9f89a59bc..01eb411019 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -64,7 +64,7 @@ if (session && session.session.full) {

Every player is a creator.

-

Explore 430+ games built by other teenagers,
or make your own and we'll send you a console!

+

Explore 800+ games built by other teenagers,
or make your own and we'll send you a console!