From 78f4632cb6b7c50d4e981d039b674d41bc7e4b8e Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Sat, 29 Apr 2023 16:11:01 -0500 Subject: [PATCH 01/11] Add files via upload Heres my Game! --- games/Antivirus.js | 296 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 games/Antivirus.js diff --git a/games/Antivirus.js b/games/Antivirus.js new file mode 100644 index 0000000000..22399bcd60 --- /dev/null +++ b/games/Antivirus.js @@ -0,0 +1,296 @@ +/* +First time? Check out the tutorial game: +https://sprig.hackclub.com/gallery/getting_started +*/ +const background = "b" +const player = "p" +const attacku = "u" +const attackr = "r" +const attackd = "d" +const attackl = "l" +const enemy = "e" +var dead = false; +var score = 0; +var spawnrate = 1000; +var spawn = setInterval(spawnE,spawnrate) + +setLegend( + [player, bitmap` +..7777777777.... +.7LLLLLLLLLL7... +.7L44444444LL7.. +.7L40044004LLL7. +.7L40044004LLL7. +.7L44444444LLL7. +.7L44044044LLL7. +.7L44400444LL7.. +.7LLLLLLLLLL7... +..7770000777.... +...7LLLLLL7..... +...7L00L4L7..... +....7LLLL7...... +...70000007..... +..7010110107.... +...70000007.....`], + [enemy, bitmap` +..3.3...33...3.. +.39393.3993.393. +.33999399993993. +.39969996699993. +.39622222222693. +.39202222220293. +.39203222230293. +.39203222230293. +.32222200222223. +.32222000022223. +.32222222222223. +.32022022022023. +.32000000000023. +.32000000000023. +.32200200200223. +..322222222223..`], + [attacku, bitmap ` +.......77....... +......7557...... +.......7557..... +.....7..7557.... +....7....7557... +.....7..7557.... +....7..7557..... +......7557...... +.....7557....... +....7557........ +...7557......... +....7557........ +.....7557....... +......7557...... +.......7557..... +........77......`], + [attackl, bitmap ` +................ +................ +................ +....7........... +...757.......... +..75557.......7. +.7557557.....757 +7557.7557...7557 +757...7557.7557. +.7.....7557557.. +...7.7..75557... +....7.7..757.... +..........7..... +................ +................ +................`], + [attackr, bitmap ` +................ +................ +................ +.....7.......... +....757..7.7.... +...75557..7.7... +..7557557.....7. +.7557.7557...757 +7557...7557.7557 +757.....7557557. +.7.......75557.. +..........757... +...........7.... +................ +................ +................`], + [attackd, bitmap ` +......77........ +.....7557....... +......7557...... +.......7557..... +........7557.... +.........7557... +........7557.... +.......7557..... +......7557...... +.....7557..7.... +....7557..7..... +...7557....7.... +....7557..7..... +.....7557....... +......7557...... +.......77.......`], + [background, bitmap` +5555444444445555 +5775DD0DDDDD5775 +5775D0D000005775 +5555DD0DDD0D5555 +4D0DDDDDDD0DDDD4 +4D0DDD0DDD0DDDD4 +400000D0D0D0DDD4 +40DDDD0DDD0DDDD4 +40DDDDDDDDDD0DD4 +40DD0DDDDDD0D0D4 +4000D0DDDDDD0DD4 +4DDD0DDD0DDD0DD4 +5555DDD0D0005555 +5775DDDD0DDD5775 +5775DDDDDDDD5775 +5555444444445555`] +); +setBackground(background) + +setSolids([]) + +let level = 0 +const levels = [map` +..........e +........... +........... +........... +........... +........... +........... +........... +.....p..... +........... +...........`] +setMap(levels[level]) + +//player movement// +onInput("s", () => { + getFirst(player).y += 1 +}) +onInput("d", () => { + getFirst(player).x += 1; +}); +onInput("w", () => { + getFirst(player).y -= 1 +}) +onInput("a", () => { + getFirst(player).x -= 1; +}); + +//player attack input// +onInput("j", () => { + let x = getFirst(player).x - 1; + let y = getFirst(player).y; + addSprite(x, y, attackl); +}) +onInput("k", () => { + let x = getFirst(player).x; + let y = getFirst(player).y + 1; + addSprite(x, y, attackd); +}); +onInput("i", () => { + let x = getFirst(player).x; + let y = getFirst(player).y - 1; + addSprite(x, y, attacku); +}) +onInput("l", () => { + let x = getFirst(player).x + 1; + let y = getFirst(player).y; + addSprite(x, y, attackr); +}); + +//attack movement// +function moveA(){ + for (var i = 0; i < getAll(attackd).length; i++) { + getAll(attackd)[i].y++; + if (getAll(attackd)[i].y >= 10){ + getAll(attackd)[i].remove(); + } + } + for (var i = 0; i < getAll(attackr).length; i++) { + getAll(attackr)[i].x++; + if(getAll(attackr)[i].x >= 10){ + getAll(attackr)[i].remove(); + } + } + for (var i = 0; i < getAll(attackl).length; i++) { + getAll(attackl)[i].x--; + if(getAll(attackl)[i].x <= 0){ + getAll(attackl)[i].remove(); + } + } + for (var i = 0; i < getAll(attacku).length; i++) { + getAll(attacku)[i].y--; + if(getAll(attacku)[i].y <= 0){ + getAll(attacku)[i].remove(); + } + } +} +//kill player on hit// +function hit(){ + for (var i = 0; i < getAll(enemy).length; i++) { + if(tilesWith(player, enemy).length > 0) { + var storex = tilesWith(player, enemy)[0][0].x + var storey = tilesWith(player, enemy)[0][0].y + clearTile(storex, storey) + addText("You Died", { + x: 6, + y: 6, + color: color`3` + }); + dead = true; + } + } +} + +//kill enemy// +function kill(){ + for (var i = 0; i < getAll(enemy).length; i++){ + if(tilesWith(attacku, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackd, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackl, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackr, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + } +} +//enemy spawn// +function spawnE() { + if(dead == false){ + let x = Math.floor(Math.random() * 11); + let y = 0; + addSprite(x, y, enemy); + spawnrate -= 1; + moveE(); + moveA(); + hit(); + kill(); + addText("Score: " + score, { + x: 0, + y: 0, + color: color`2` + }); + } +} + +//enemy movement// +function moveE(){ + for (var i = 0; i < getAll(enemy).length; i++) { + getAll(enemy)[i].y++; + var slope = ((getFirst(player).y - getAll(enemy)[i].y) / (getFirst(player).x - getAll(enemy)[i].x)) + if (Math.round(1 / slope) > 0.8) { + getAll(enemy)[i].x++; + } else if (Math.round(1 / slope) < - 0.8) { + getAll(enemy)[i].x--; + } + } +} \ No newline at end of file From 11653a2d19bb306b31243a43d13aac3981f94af6 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Sat, 29 Apr 2023 16:14:20 -0500 Subject: [PATCH 02/11] Delete Antivirus.js --- games/Antivirus.js | 296 --------------------------------------------- 1 file changed, 296 deletions(-) delete mode 100644 games/Antivirus.js diff --git a/games/Antivirus.js b/games/Antivirus.js deleted file mode 100644 index 22399bcd60..0000000000 --- a/games/Antivirus.js +++ /dev/null @@ -1,296 +0,0 @@ -/* -First time? Check out the tutorial game: -https://sprig.hackclub.com/gallery/getting_started -*/ -const background = "b" -const player = "p" -const attacku = "u" -const attackr = "r" -const attackd = "d" -const attackl = "l" -const enemy = "e" -var dead = false; -var score = 0; -var spawnrate = 1000; -var spawn = setInterval(spawnE,spawnrate) - -setLegend( - [player, bitmap` -..7777777777.... -.7LLLLLLLLLL7... -.7L44444444LL7.. -.7L40044004LLL7. -.7L40044004LLL7. -.7L44444444LLL7. -.7L44044044LLL7. -.7L44400444LL7.. -.7LLLLLLLLLL7... -..7770000777.... -...7LLLLLL7..... -...7L00L4L7..... -....7LLLL7...... -...70000007..... -..7010110107.... -...70000007.....`], - [enemy, bitmap` -..3.3...33...3.. -.39393.3993.393. -.33999399993993. -.39969996699993. -.39622222222693. -.39202222220293. -.39203222230293. -.39203222230293. -.32222200222223. -.32222000022223. -.32222222222223. -.32022022022023. -.32000000000023. -.32000000000023. -.32200200200223. -..322222222223..`], - [attacku, bitmap ` -.......77....... -......7557...... -.......7557..... -.....7..7557.... -....7....7557... -.....7..7557.... -....7..7557..... -......7557...... -.....7557....... -....7557........ -...7557......... -....7557........ -.....7557....... -......7557...... -.......7557..... -........77......`], - [attackl, bitmap ` -................ -................ -................ -....7........... -...757.......... -..75557.......7. -.7557557.....757 -7557.7557...7557 -757...7557.7557. -.7.....7557557.. -...7.7..75557... -....7.7..757.... -..........7..... -................ -................ -................`], - [attackr, bitmap ` -................ -................ -................ -.....7.......... -....757..7.7.... -...75557..7.7... -..7557557.....7. -.7557.7557...757 -7557...7557.7557 -757.....7557557. -.7.......75557.. -..........757... -...........7.... -................ -................ -................`], - [attackd, bitmap ` -......77........ -.....7557....... -......7557...... -.......7557..... -........7557.... -.........7557... -........7557.... -.......7557..... -......7557...... -.....7557..7.... -....7557..7..... -...7557....7.... -....7557..7..... -.....7557....... -......7557...... -.......77.......`], - [background, bitmap` -5555444444445555 -5775DD0DDDDD5775 -5775D0D000005775 -5555DD0DDD0D5555 -4D0DDDDDDD0DDDD4 -4D0DDD0DDD0DDDD4 -400000D0D0D0DDD4 -40DDDD0DDD0DDDD4 -40DDDDDDDDDD0DD4 -40DD0DDDDDD0D0D4 -4000D0DDDDDD0DD4 -4DDD0DDD0DDD0DD4 -5555DDD0D0005555 -5775DDDD0DDD5775 -5775DDDDDDDD5775 -5555444444445555`] -); -setBackground(background) - -setSolids([]) - -let level = 0 -const levels = [map` -..........e -........... -........... -........... -........... -........... -........... -........... -.....p..... -........... -...........`] -setMap(levels[level]) - -//player movement// -onInput("s", () => { - getFirst(player).y += 1 -}) -onInput("d", () => { - getFirst(player).x += 1; -}); -onInput("w", () => { - getFirst(player).y -= 1 -}) -onInput("a", () => { - getFirst(player).x -= 1; -}); - -//player attack input// -onInput("j", () => { - let x = getFirst(player).x - 1; - let y = getFirst(player).y; - addSprite(x, y, attackl); -}) -onInput("k", () => { - let x = getFirst(player).x; - let y = getFirst(player).y + 1; - addSprite(x, y, attackd); -}); -onInput("i", () => { - let x = getFirst(player).x; - let y = getFirst(player).y - 1; - addSprite(x, y, attacku); -}) -onInput("l", () => { - let x = getFirst(player).x + 1; - let y = getFirst(player).y; - addSprite(x, y, attackr); -}); - -//attack movement// -function moveA(){ - for (var i = 0; i < getAll(attackd).length; i++) { - getAll(attackd)[i].y++; - if (getAll(attackd)[i].y >= 10){ - getAll(attackd)[i].remove(); - } - } - for (var i = 0; i < getAll(attackr).length; i++) { - getAll(attackr)[i].x++; - if(getAll(attackr)[i].x >= 10){ - getAll(attackr)[i].remove(); - } - } - for (var i = 0; i < getAll(attackl).length; i++) { - getAll(attackl)[i].x--; - if(getAll(attackl)[i].x <= 0){ - getAll(attackl)[i].remove(); - } - } - for (var i = 0; i < getAll(attacku).length; i++) { - getAll(attacku)[i].y--; - if(getAll(attacku)[i].y <= 0){ - getAll(attacku)[i].remove(); - } - } -} -//kill player on hit// -function hit(){ - for (var i = 0; i < getAll(enemy).length; i++) { - if(tilesWith(player, enemy).length > 0) { - var storex = tilesWith(player, enemy)[0][0].x - var storey = tilesWith(player, enemy)[0][0].y - clearTile(storex, storey) - addText("You Died", { - x: 6, - y: 6, - color: color`3` - }); - dead = true; - } - } -} - -//kill enemy// -function kill(){ - for (var i = 0; i < getAll(enemy).length; i++){ - if(tilesWith(attacku, enemy).length > 0) { - var storex = getAll(enemy)[i].x - var storey = getAll(enemy)[i].y - clearTile(storex, storey) - score+=1; -} - if(tilesWith(attackd, enemy).length > 0) { - var storex = getAll(enemy)[i].x - var storey = getAll(enemy)[i].y - clearTile(storex, storey) - score+=1; -} - if(tilesWith(attackl, enemy).length > 0) { - var storex = getAll(enemy)[i].x - var storey = getAll(enemy)[i].y - clearTile(storex, storey) - score+=1; -} - if(tilesWith(attackr, enemy).length > 0) { - var storex = getAll(enemy)[i].x - var storey = getAll(enemy)[i].y - clearTile(storex, storey) - score+=1; -} - } -} -//enemy spawn// -function spawnE() { - if(dead == false){ - let x = Math.floor(Math.random() * 11); - let y = 0; - addSprite(x, y, enemy); - spawnrate -= 1; - moveE(); - moveA(); - hit(); - kill(); - addText("Score: " + score, { - x: 0, - y: 0, - color: color`2` - }); - } -} - -//enemy movement// -function moveE(){ - for (var i = 0; i < getAll(enemy).length; i++) { - getAll(enemy)[i].y++; - var slope = ((getFirst(player).y - getAll(enemy)[i].y) / (getFirst(player).x - getAll(enemy)[i].x)) - if (Math.round(1 / slope) > 0.8) { - getAll(enemy)[i].x++; - } else if (Math.round(1 / slope) < - 0.8) { - getAll(enemy)[i].x--; - } - } -} \ No newline at end of file From 16d057da6b1fbb37535227884ef49566234dd979 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Sat, 29 Apr 2023 16:17:32 -0500 Subject: [PATCH 03/11] Add files via upload --- games/Antivirus.js | 296 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 games/Antivirus.js diff --git a/games/Antivirus.js b/games/Antivirus.js new file mode 100644 index 0000000000..22399bcd60 --- /dev/null +++ b/games/Antivirus.js @@ -0,0 +1,296 @@ +/* +First time? Check out the tutorial game: +https://sprig.hackclub.com/gallery/getting_started +*/ +const background = "b" +const player = "p" +const attacku = "u" +const attackr = "r" +const attackd = "d" +const attackl = "l" +const enemy = "e" +var dead = false; +var score = 0; +var spawnrate = 1000; +var spawn = setInterval(spawnE,spawnrate) + +setLegend( + [player, bitmap` +..7777777777.... +.7LLLLLLLLLL7... +.7L44444444LL7.. +.7L40044004LLL7. +.7L40044004LLL7. +.7L44444444LLL7. +.7L44044044LLL7. +.7L44400444LL7.. +.7LLLLLLLLLL7... +..7770000777.... +...7LLLLLL7..... +...7L00L4L7..... +....7LLLL7...... +...70000007..... +..7010110107.... +...70000007.....`], + [enemy, bitmap` +..3.3...33...3.. +.39393.3993.393. +.33999399993993. +.39969996699993. +.39622222222693. +.39202222220293. +.39203222230293. +.39203222230293. +.32222200222223. +.32222000022223. +.32222222222223. +.32022022022023. +.32000000000023. +.32000000000023. +.32200200200223. +..322222222223..`], + [attacku, bitmap ` +.......77....... +......7557...... +.......7557..... +.....7..7557.... +....7....7557... +.....7..7557.... +....7..7557..... +......7557...... +.....7557....... +....7557........ +...7557......... +....7557........ +.....7557....... +......7557...... +.......7557..... +........77......`], + [attackl, bitmap ` +................ +................ +................ +....7........... +...757.......... +..75557.......7. +.7557557.....757 +7557.7557...7557 +757...7557.7557. +.7.....7557557.. +...7.7..75557... +....7.7..757.... +..........7..... +................ +................ +................`], + [attackr, bitmap ` +................ +................ +................ +.....7.......... +....757..7.7.... +...75557..7.7... +..7557557.....7. +.7557.7557...757 +7557...7557.7557 +757.....7557557. +.7.......75557.. +..........757... +...........7.... +................ +................ +................`], + [attackd, bitmap ` +......77........ +.....7557....... +......7557...... +.......7557..... +........7557.... +.........7557... +........7557.... +.......7557..... +......7557...... +.....7557..7.... +....7557..7..... +...7557....7.... +....7557..7..... +.....7557....... +......7557...... +.......77.......`], + [background, bitmap` +5555444444445555 +5775DD0DDDDD5775 +5775D0D000005775 +5555DD0DDD0D5555 +4D0DDDDDDD0DDDD4 +4D0DDD0DDD0DDDD4 +400000D0D0D0DDD4 +40DDDD0DDD0DDDD4 +40DDDDDDDDDD0DD4 +40DD0DDDDDD0D0D4 +4000D0DDDDDD0DD4 +4DDD0DDD0DDD0DD4 +5555DDD0D0005555 +5775DDDD0DDD5775 +5775DDDDDDDD5775 +5555444444445555`] +); +setBackground(background) + +setSolids([]) + +let level = 0 +const levels = [map` +..........e +........... +........... +........... +........... +........... +........... +........... +.....p..... +........... +...........`] +setMap(levels[level]) + +//player movement// +onInput("s", () => { + getFirst(player).y += 1 +}) +onInput("d", () => { + getFirst(player).x += 1; +}); +onInput("w", () => { + getFirst(player).y -= 1 +}) +onInput("a", () => { + getFirst(player).x -= 1; +}); + +//player attack input// +onInput("j", () => { + let x = getFirst(player).x - 1; + let y = getFirst(player).y; + addSprite(x, y, attackl); +}) +onInput("k", () => { + let x = getFirst(player).x; + let y = getFirst(player).y + 1; + addSprite(x, y, attackd); +}); +onInput("i", () => { + let x = getFirst(player).x; + let y = getFirst(player).y - 1; + addSprite(x, y, attacku); +}) +onInput("l", () => { + let x = getFirst(player).x + 1; + let y = getFirst(player).y; + addSprite(x, y, attackr); +}); + +//attack movement// +function moveA(){ + for (var i = 0; i < getAll(attackd).length; i++) { + getAll(attackd)[i].y++; + if (getAll(attackd)[i].y >= 10){ + getAll(attackd)[i].remove(); + } + } + for (var i = 0; i < getAll(attackr).length; i++) { + getAll(attackr)[i].x++; + if(getAll(attackr)[i].x >= 10){ + getAll(attackr)[i].remove(); + } + } + for (var i = 0; i < getAll(attackl).length; i++) { + getAll(attackl)[i].x--; + if(getAll(attackl)[i].x <= 0){ + getAll(attackl)[i].remove(); + } + } + for (var i = 0; i < getAll(attacku).length; i++) { + getAll(attacku)[i].y--; + if(getAll(attacku)[i].y <= 0){ + getAll(attacku)[i].remove(); + } + } +} +//kill player on hit// +function hit(){ + for (var i = 0; i < getAll(enemy).length; i++) { + if(tilesWith(player, enemy).length > 0) { + var storex = tilesWith(player, enemy)[0][0].x + var storey = tilesWith(player, enemy)[0][0].y + clearTile(storex, storey) + addText("You Died", { + x: 6, + y: 6, + color: color`3` + }); + dead = true; + } + } +} + +//kill enemy// +function kill(){ + for (var i = 0; i < getAll(enemy).length; i++){ + if(tilesWith(attacku, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackd, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackl, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + if(tilesWith(attackr, enemy).length > 0) { + var storex = getAll(enemy)[i].x + var storey = getAll(enemy)[i].y + clearTile(storex, storey) + score+=1; +} + } +} +//enemy spawn// +function spawnE() { + if(dead == false){ + let x = Math.floor(Math.random() * 11); + let y = 0; + addSprite(x, y, enemy); + spawnrate -= 1; + moveE(); + moveA(); + hit(); + kill(); + addText("Score: " + score, { + x: 0, + y: 0, + color: color`2` + }); + } +} + +//enemy movement// +function moveE(){ + for (var i = 0; i < getAll(enemy).length; i++) { + getAll(enemy)[i].y++; + var slope = ((getFirst(player).y - getAll(enemy)[i].y) / (getFirst(player).x - getAll(enemy)[i].x)) + if (Math.round(1 / slope) > 0.8) { + getAll(enemy)[i].x++; + } else if (Math.round(1 / slope) < - 0.8) { + getAll(enemy)[i].x--; + } + } +} \ No newline at end of file From a88a1a8468333a3f2f2dc6b609bbae50ae8059c6 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Tue, 2 May 2023 21:51:13 -0500 Subject: [PATCH 04/11] Update Antivirus.js --- games/Antivirus.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/games/Antivirus.js b/games/Antivirus.js index 22399bcd60..361470b541 100644 --- a/games/Antivirus.js +++ b/games/Antivirus.js @@ -1,7 +1,5 @@ -/* -First time? Check out the tutorial game: -https://sprig.hackclub.com/gallery/getting_started -*/ +//my insperation is space invaders// + const background = "b" const player = "p" const attacku = "u" @@ -293,4 +291,4 @@ function moveE(){ getAll(enemy)[i].x--; } } -} \ No newline at end of file +} From 77f0a206d5f98e8984a81e82d6f7662179ea5a4a Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Mon, 8 May 2023 10:28:47 -0500 Subject: [PATCH 05/11] Add files via upload --- games/Pet_the_Cat.js | 165 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 games/Pet_the_Cat.js diff --git a/games/Pet_the_Cat.js b/games/Pet_the_Cat.js new file mode 100644 index 0000000000..b40367f920 --- /dev/null +++ b/games/Pet_the_Cat.js @@ -0,0 +1,165 @@ +//I have 5 cats and 2 dogs// + +const player = "p" +const exstend = "e" +const pat = "s" +const cat = "c" +const pattedcat= "a" +const background = "b" +var pats = 0 +setBackground(background) + +setLegend( + [ player, bitmap` +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0000000000... +..00CCCCCCCC00.. +.00CCCCCCCCCC0.. +.0CCCCCCCCCCC0.. +.0C0CCCCCCCCC0.. +.0C0CCCCCCCCC0.. +..00C0CC0CC0C0.. +...0C0CC0CC0C0.. +...00000000000..` ], + [ exstend, bitmap` +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220...` ], + [ pat, bitmap` +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +...0222222220... +..00000000000... +.0CCCCCCCCCC00.. +0CCCCCCCCCCCC000 +0CC0000CCCCCCCC0` ], + [ cat, bitmap` +...0........0... +..0L0......0L0.. +.0L8L0....0L8L0. +0L888L0000L888L0 +0LLLLLLLLLLLLLL0 +0LL00LLLLLL00LL0 +0L04D0LLLL0D40L0 +0L04D0LLLL0D40L0 +0L04D0LLLL0D40L0 +0L0440LLLL0440L0 +0LL00LLLLLL00LL0 +0LLLLL8888LLLLL0 +0L0000L88L0000L0 +0LLL0LLLLLL0LLL0 +0LL0LLLLLLLL0LL0 +0LLLLLLLLLLLLLL0` ], + [ pattedcat, bitmap` +.0CCCCCCCCCCCC0. +..00CCCCCCCC00.. +.0080CCCCCC0800. +0888000000008880 +0LLLLLLLLLLLLLL0 +0LL00LLLLLL00LL0 +0L0LL0LLLL0LL0L0 +00LLLL0LL0LLLL00 +0LLLLL0LL0LLLLL0 +0LLLLLLLLLLLLLL0 +0LLLLL8888LLLLL0 +0L0000L88L0000L0 +0LL0LL0000LL0LL0 +0L0LL022220LL0L0 +0LLLL023320LLLL0 +0LLLL038830LLLL0` ], + [ background, bitmap` +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777`] +) + +setSolids([]) + +let level = 0 +const levels = [ + map` +p +. +c` +] + +setMap(levels[level]) + +setPushables({ + [ player ]: [] +}) + +onInput("s", () => { + petting() +}) +onInput("w", () => { + reset() +}) +onInput("i", () => { + reset() +}) +onInput("k", () => { + petting() +}) + +setInterval(function() { + addText("Pats: " + pats, { + color: color`4` + }) +}) +function petting(){ + getFirst(player).remove() + addSprite(0, 0, "e") + addSprite(0, 1, "s") + getFirst(cat).remove() + addSprite(0, 2, "a") + pats++ +} +function reset(){ + getFirst(pattedcat).remove() + getFirst(exstend).remove() + getFirst(pat).remove() + addSprite(0, 0, "p") + addSprite(0,2, "c") +} From 1642017882f7e6c99a61e463e70ac6e5d8f56a3a Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:29:28 -0500 Subject: [PATCH 06/11] Add files via upload --- games/Hard-Hat Helper.js | 542 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 542 insertions(+) create mode 100644 games/Hard-Hat Helper.js diff --git a/games/Hard-Hat Helper.js b/games/Hard-Hat Helper.js new file mode 100644 index 0000000000..1475ee55b9 --- /dev/null +++ b/games/Hard-Hat Helper.js @@ -0,0 +1,542 @@ +//based on Mario vs. Donkey Kong: Mini-Land Mayhem! for the 3DS + +const playerR = "r" +const playerL = "l" +const background = "b" +const goal = "g" +const wall = "w" +const platformOFF = "f" +const platformON = "o" +const lift = "e" +const spring = "s" +const detectionR = "d" +const detectionL = "a" +const detectionDR = "z" +const detectionDL = "c" +const platform = "p" +const rBelt = "t" +const lBelt = "j" + +setLegend( + [ playerR, bitmap` +................ +................ +....00000000.... +...0666666660... +..066600006660.. +..066066660660.. +.06606600660660. +.06066066066060. +0666606666066660 +.000L27LL27L000. +...0L27LL27L0... +...0LLLLLLLL0... +...0LLL00LLL0... +...0CC0..0CC0... +...0CCC0.0CCC0.. +...00000.00000..` ], + [ playerL, bitmap` +................ +................ +....00000000.... +...0666666660... +..066600006660.. +..066066660660.. +.06606600660660. +.06066066066060. +0666606666066660 +.000L72LL72L000. +...0L72LL72L0... +...0LLLLLLLL0... +...0LLL00LLL0... +...0CC0..0CC0... +..0CCC0.0CCC0... +..00000.00000...` ], + [ background, bitmap` +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777 +7777777777777777`], + [ wall, bitmap` +0000000000000000 +010..........010 +0000........0000 +0.010LLLLLL010.0 +0..000....000..0 +0..L010..010L..0 +0..L.000000.L..0 +0..L..0LL0..L..0 +0..L..0LL0..L..0 +0..L.000000.L..0 +0..L010..010L..0 +0..000....000..0 +0.010LLLLLL010.0 +0000........0000 +010..........010 +0000000000000000`], + [ goal, bitmap` +..00000......... +..0CC4400....... +..0CCDD4400..... +..0CC44DD4400... +..0CCDD44DD4400. +..0CC44DD44DD440 +..0CCDD44DD4400. +..0CC44DD4400... +..0CCDD4400..... +..0CC4400....... +..0CC00......... +..0CC0.......... +..0CC0.......... +..0CC0.......... +..0CC0.......... +..0CC0..........`], + [ platformOFF, bitmap` +0000000000000000 +030LLLLLLLLLL030 +030LLLLLLLLLL030 +030LLLLLLLLLL030 +030LL00LLLLLL030 +000L0LL0L0LLL000 +0LLL0LL0LL0LLLL0 +0LLL000LLLL0LLL0 +0LLL0L0LLL0LLLL0 +0LLL0LL0L0LLLLL0 +000LLLLLLLLLL000 +030LLLLLLLLLL030 +030LLLLLLLLLL030 +030LLLLLLLLLL030 +030LLLLLLLLLL030 +0000000000000000`], + [ platformON, bitmap` +LLLLLLLLLLLLLLLL +L4L1111111111L4L +L4L1111111111L4L +L4L1111111111L4L +L4L1100111111L4L +LLL1011010111LLL +L11101101101111L +L11100011110111L +L11101011101111L +L11101101011111L +LLL1111111111LLL +L4L1111111111L4L +L4L1111111111L4L +L4L1111111111L4L +L4L1111111111L4L +LLLLLLLLLLLLLLLL`], + [detectionR, bitmap` +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555`], + [detectionL, bitmap` +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555`], + [detectionDR, bitmap` +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555`], + [detectionDL, bitmap` +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555`], + [lift, bitmap` +0000000000000000 +0999999999999990 +090L........L090 +.0L9999999999L0. +.0.90LLLLLL09.0. +.0.9LLLLL0LL9.0. +.0.9L0LL0L0L9.0. +.0.9L0LLLLLL9.0. +.0.9L0LL0L0L9.0. +.0.9L000L0LL9.0. +.0.9LLLLLLLL9.0. +.0.90LLLLLL09.0. +.0L9999999999L0. +090L........L090 +0999999999999990 +0000000000000000`], + [spring, bitmap` +.00000000000000. +0333333003333330 +0333330330333330 +0333303333033330 +0333033333303330 +.00000000000000. +..LL111LL111LL.. +..11LL111LL111.. +..L111LL111LL1.. +..1LL111LL111L.. +..111LL111LL11.. +00LL111LL111LL00 +0LLLLLLLLLLLLLL0 +0LLLLLLLLLLLLLL0 +0LLLLLLLLLLLLLL0 +0000000000000000`], + [platform, bitmap` +.L000000000000L. +L1L9999999999L1L +0L999999999999L0 +0999990999999990 +0999990999999990 +0999990999999990 +0999190000919990 +0991L999999L1990 +091LL999999LL190 +01LLLLL99LLLLL10 +01LLLLL99LLLLL10 +091LL999999LL190 +0991L999999L1990 +0L991999999199L0 +L1L9999999999L1L +.L000000000000L.`], + [lBelt, bitmap` +0.0.0.0.0.0.0.0. +0000000000000000 +1111..1111..1111 +1LL1..1LL1..1LL1 +1LL1CCCCCCCC1LL1 +CCCCC110111CCCCC +9939C101001C9939 +9399C011001C9399 +9399C011010C9399 +9939C101010C9939 +CCCCC110111CCCCC +1LL1CCCCCCCC1LL1 +1LL1..1LL1..1LL1 +1111..1111..1111 +0000000000000000 +.0.0.0.0.0.0.0.0`], + [rBelt, bitmap` +0.0.0.0.0.0.0.0. +0000000000000000 +1111..1111..1111 +1LL1..1LL1..1LL1 +1LL1CCCCCCCC1LL1 +CCCCC110111CCCCC +9799C101001C9799 +9979C011001C9979 +9979C011010C9979 +9799C101010C9799 +CCCCC110111CCCCC +1LL1CCCCCCCC1LL1 +1LL1..1LL1..1LL1 +1111..1111..1111 +0000000000000000 +.0.0.0.0.0.0.0.0`] +) +setBackground(background); + +var level = 0 +const levels = [ + //10 levels + map` +...... +...... +...... +...... +wr..gw +wwwfww`, //1 + map` +...... +...... +...... +...... +wg..rw +wwffww`, //2 + map` +...... +...... +...... +....gw +wr..ww +wwfs..`, //3 + map` +wwwwww +wg...w +wwoo.w +w....w +wl..ew +wwffww`, //4 + map` +...e.ewew +....w.w.w +....w.w.g +....w.w.w +w.l.w...w +wwwwwwwww`, //5 + map` +w.....w +w.....w +w.....w +w.....w +wr...gw +wwp..ww`, //6 + map` +w......g +w...pwww +we.....w +ww..p..w +wr....ew +ww..pwww`, //7 + map` +wwwwwww +w.....w +w.....w +w.....w +w.....w +wr...gw +wwjjjww`, //8 + map` +wr....ew +wwjjjj.w +we.....w +w.jjjjww +w.....ew +wwjjjj.w +wg.....w +wwjjjjww`, //9 + map` +w....ww +w.....w +w.ttt.w +weg...w +www..ew +wr..www +wwfs..w` //10 +] +setMap(levels[level]); +setSolids([platformON, playerR, playerL, wall, spring, platform, lBelt, rBelt]); + +onInput("l", () => { + platformONOFF() +}); +onInput("w", () => { + liftUP() +}); +onInput("s", () => { + liftDOWN() +}); +onInput("a", () => { + mpL() +}); +onInput("d", () => { + mpR() +}); +onInput("j", () =>{ + beltC(); +}) + +const movep = setInterval(move, 1000) + +//moving platforms +function mpR(){ + for(let i = 0; i < getAll(platform).length; i++){ + getAll(platform)[i].x += 1 + } +} +function mpL(){ + for(let i = 0; i < getAll(platform).length; i++){ + getAll(platform)[i].x -= 1 + } +} + +//turns the platforms on or off +var num = 1; +function platformONOFF(){ + num += 1 + if(num % 2 == 0){ + for(let i = 0; i < getAll(platformOFF).length; i++){ + let px = getAll(platformOFF)[i].x + let py = getAll(platformOFF)[i].y + getAll(platformOFF)[i].remove() + addSprite(px, py, platformON) + } + } + if(num % 2 != 0){ + for(let i = 0; i < getAll(platformON).length; i++){ + let px = getAll(platformON)[i].x + let py = getAll(platformON)[i].y + getAll(platformON)[i].remove() + addSprite(px, py, platformOFF) + } + } +} + +//belt controlls +var num2 = 1; +function beltC(){ + num2 += 1 + if(num2 % 2 == 0){ + for(let i = 0; i < getAll(lBelt).length; i++){ + let px = getAll(lBelt)[i].x + let py = getAll(lBelt)[i].y + getAll(lBelt)[i].remove() + addSprite(px, py, rBelt) + } + } + if(num2 % 2 != 0){ + for(let i = 0; i < getAll(rBelt).length; i++){ + let px = getAll(rBelt)[i].x + let py = getAll(rBelt)[i].y + getAll(rBelt)[i].remove() + addSprite(px, py, lBelt) + } + } +} + +//move charater back and forth,wall & floor detection, and check win condition +function move(){ + if(tilesWith(playerR, goal).length > 0 || tilesWith(playerL, goal).length > 0){ + level = level + 1; + setMap(levels[level]); + } +//right -> left + for( let i = 0; i < getAll(playerR).length; i++){ + let px = getAll(playerR)[i].x + let py = getAll(playerR)[i].y + let dx = px + 1 + let dy = py + 1 + addSprite(dx, py, detectionR) + addSprite(dx, dy, detectionDR) + if(tilesWith(detectionR, wall).length == 1 || tilesWith(detectionDR, wall).length == 0 && tilesWith(detectionDR, platformON).length == 0 && tilesWith(spring, detectionDR).length == 0 && tilesWith(detectionR, lift).length == 0 && tilesWith(platform, detectionDR).length == 0 && tilesWith(rBelt, detectionDR).length == 0){ + getAll(playerR)[i].remove() + getAll(detectionR)[i].remove() + getAll(detectionDR)[i].remove() + addSprite(px, py, playerL) + }else if (tilesWith(detectionDR, spring).length == 1){ + getAll(playerR)[i].x += 1 + getAll(playerR)[i].y -= 1 + getAll(playerR)[i].x += 1 + getAll(detectionR)[i].remove() + getAll(detectionDR)[i].remove() + }else{ + getAll(playerR)[i].x += 1 + getAll(detectionR)[i].remove() + getAll(detectionDR)[i].remove() + } + } + //left -> right + for(let i = 0; i < getAll(playerL).length; i++){ + let px = getAll(playerL)[i].x + let py = getAll(playerL)[i].y + let dx = px - 1 + let dy = py + 1 + addSprite(dx, py, detectionL) + addSprite(dx, dy, detectionDL) + if(tilesWith(detectionL, wall).length == 1 || tilesWith(detectionDL, wall).length == 0 && tilesWith(detectionDL, platformON).length == 0 && tilesWith(spring, detectionDL).length == 0 && tilesWith(detectionL, lift).length == 0 && tilesWith(platform, detectionDL).length == 0 && tilesWith(lBelt, detectionDR).length == 0){ + getAll(playerL)[i].remove() + getAll(detectionL)[i].remove() + getAll(detectionDL)[i].remove() + addSprite(px, py, playerR) + }else if (tilesWith(detectionDL, spring).length == 1){ + getAll(playerL)[i].x -= 1 + getAll(playerL)[i].y -= 1 + getAll(playerL)[i].x -= 1 + getAll(detectionL)[i].remove() + getAll(detectionDL)[i].remove() + }else{ + getAll(playerL)[i].x -= 1 + getAll(detectionL)[i].remove() + getAll(detectionDL)[i].remove() + } + } +} + +//lift functions up and down +function liftUP(){ + for(let i = 0; i < getAll(lift).length; i++){ + for(let i = 0; i < getAll(playerR).length; i++){ + if(tilesWith(playerR, lift).length == 1){ + getAll(playerR)[i].y -= 1 + } + } + for(let i = 0; i < getAll(playerL).length; i++){ + if(tilesWith(playerL, lift).length == 1){ + getAll(playerL)[i].y -= 1 + } + } + getAll(lift)[i].y -= 1 + } +} +function liftDOWN(){ + for(let i = 0; i < getAll(lift).length; i++){ + for(let i = 0; i < getAll(playerR).length; i++){ + if(tilesWith(playerR, lift).length == 1){ + getAll(playerR)[i].y += 1 + } + } + for(let i = 0; i < getAll(playerL).length; i++){ + if(tilesWith(playerL, lift).length == 1){ + getAll(playerL)[i].y += 1 + } + } + getAll(lift)[i].y += 1 + } +} \ No newline at end of file From f414e13ae4b03a93430453ed5c04ec164e29503c Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:09:51 -0500 Subject: [PATCH 07/11] Update Hard-Hat Helper.js --- games/Hard-Hat Helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/games/Hard-Hat Helper.js b/games/Hard-Hat Helper.js index 1475ee55b9..d0633379be 100644 --- a/games/Hard-Hat Helper.js +++ b/games/Hard-Hat Helper.js @@ -490,7 +490,7 @@ function move(){ let dy = py + 1 addSprite(dx, py, detectionL) addSprite(dx, dy, detectionDL) - if(tilesWith(detectionL, wall).length == 1 || tilesWith(detectionDL, wall).length == 0 && tilesWith(detectionDL, platformON).length == 0 && tilesWith(spring, detectionDL).length == 0 && tilesWith(detectionL, lift).length == 0 && tilesWith(platform, detectionDL).length == 0 && tilesWith(lBelt, detectionDR).length == 0){ + if(tilesWith(detectionL, wall).length == 1 || tilesWith(detectionDL, wall).length == 0 && tilesWith(detectionDL, platformON).length == 0 && tilesWith(spring, detectionDL).length == 0 && tilesWith(detectionL, lift).length == 0 && tilesWith(platform, detectionDL).length == 0 && tilesWith(lBelt, detectionDL).length == 0){ getAll(playerL)[i].remove() getAll(detectionL)[i].remove() getAll(detectionDL)[i].remove() @@ -539,4 +539,4 @@ function liftDOWN(){ } getAll(lift)[i].y += 1 } -} \ No newline at end of file +} From 491be32d749cdead471dc69ae2ff3bc8bbd5ba5e Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:20:46 -0600 Subject: [PATCH 08/11] Add files via upload --- games/SprigbattleShip.js | 660 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 660 insertions(+) create mode 100644 games/SprigbattleShip.js diff --git a/games/SprigbattleShip.js b/games/SprigbattleShip.js new file mode 100644 index 0000000000..25bf55d263 --- /dev/null +++ b/games/SprigbattleShip.js @@ -0,0 +1,660 @@ +/* +First time? Check out the tutorial game: +https://sprig.hackclub.com/gallery/getting_started +*/ + +// based on battleship + +//WASD (left side) to move and L (the button to the right on the right side) to place shipts and attack on specifyed spaces + +//17 ships (I dont know how to line them up like in real battleship so this is the next best thing) +//10x10 board (A-I)x(1-10) + +const player = "p" +const c1 = "1" +const c2 = "2" +const c3 = "3" +const c4 = "4" +const c5 = "5" +const c6 = "6" +const c7 = "7" +const c8 = "8" +const c9 = "9" +const c10 = "0" +const rA = "q" +const rB = "w" +const rC = "e" +const rD = "r" +const rE = "t" +const rF = "y" +const rG = "u" +const rH = "i" +const rI = "o" +const background = "a" +const extrabackground = "s" +const ship = "d" +const miss = "f" +const hit = "g" +const emiss = "j" +const eposition = "k" +const eattack = "l" + +setLegend( + [player, bitmap` +55555......55555 +5777........7775 +57............75 +57............75 +5..............5 +................ +................ +................ +................ +................ +................ +5..............5 +57............75 +57............75 +5777........7775 +55555......55555` ], + [c1, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLL0000LLLLLL1 +1LL000000LLLLLL1 +1LL000L00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1L000000000000L1 +1L000000000000L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c2, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLL00000LLLLL1 +1LLL0000000LLLL1 +1LL000LLL000LLL1 +1L000LLLLL000LL1 +1LLLLLLLL000LLL1 +1LLLLLLL000LLLL1 +1LLLLLL000LLLLL1 +1LLLLL000LLLLLL1 +1LLL0000LLLLLLL1 +1LL00000LLLLLLL1 +1L000000000000L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c3, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLL00000LLLLL1 +1LLL0000000LLLL1 +1LLLLLLL0000LLL1 +1LLLLLLLL000LLL1 +1LLLLLLL0000LLL1 +1LLLL000000LLLL1 +1LLLL000000LLLL1 +1LLLLLLL0000LLL1 +1LLLLLLLL000LLL1 +1LLLLLLL0000LLL1 +1LLL0000000LLLL1 +1LLLL00000LLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c4, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLL000LLLLLL1 +1LLLL0000LLLLLL1 +1LLL00L00LLLLLL1 +1LL00LL00LLLLLL1 +1L00LLL00LLLLLL1 +1L000000000000L1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c5, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1L000000000000L1 +1L000000000000L1 +1L00LLLLLLLLLLL1 +1L00LLLLLLLLLLL1 +1L000LLLLLLLLLL1 +1LL0000LLLLLLLL1 +1LLL00000000LLL1 +1LLLL00000000LL1 +1LLLLLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00000000000LL1 +1LL000000000LLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c6, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLL00000LLLLL1 +1LLL0000000LLLL1 +1LL000LLLLLLLLL1 +1L000LLLLLLLLLL1 +1L00LLLLLLLLLLL1 +1L0000000000LLL1 +1L000LLLLLL00LL1 +1L00LLLLLLLL0LL1 +1L00LLLLLLLL0LL1 +1L000LLLLLL00LL1 +1LL000LLLL00LLL1 +1LLL0000000LLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c7, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1L000000000000L1 +1L000000000000L1 +1LLLLLLLLLL000L1 +1LLLLLLLLL000LL1 +1LLLLLLLL000LLL1 +1LLLLLLL000LLLL1 +1LLLLLL000LLLLL1 +1LLLLL000LLLLLL1 +1LLLL000LLLLLLL1 +1LLL000LLLLLLLL1 +1LL000LLLLLLLLL1 +1L000LLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c8, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLL000000LLLL1 +1LLL00000000LLL1 +1LL00LLLLLL00LL1 +1LL0LLLLLLLL0LL1 +1LL00LLLLLL00LL1 +1LLL00000000LLL1 +1LLL00000000LLL1 +1LL00LLLLLL00LL1 +1LL0LLLLLLLL0LL1 +1LL00LLLLLL00LL1 +1LLL00000000LLL1 +1LLLL000000LLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c9, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLL000000LLLL1 +1LLL00LLLL00LLL1 +1LLL0LLLLLL0LLL1 +1LLL0LLLLLL0LLL1 +1LLL00LLLL00LLL1 +1LLLL0000000LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLL00LLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [c10, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL00LLL0000LLL1 +1LL00LL000000LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL00LL00LL1 +1LL00LL000000LL1 +1LL00LLL0000LLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rA, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLL0000LLLLL1 +1LLLL00LL00LLLL1 +1LLLL0LLLL0LLLL1 +1LLL00LLLL00LLL1 +1LLL00LLLL00LLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LL00LLLLLL00LL1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rB, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL0000LLLLLLLL1 +1LL000000LLLLLL1 +1LL00LLL00LLLLL1 +1LL00LLLL00LLLL1 +1LL00LLLL00LLLL1 +1LL0000000LLLLL1 +1LL00000000LLLL1 +1LL00LLLLL00LLL1 +1LL00LLLLLL00LL1 +1LL00LLLLLL00LL1 +1LL000000000LLL1 +1LL00000000LLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rC, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLLL00000000L1 +1LLLL000000000L1 +1LLL0000LLLLLLL1 +1LL000LLLLLLLLL1 +1L000LLLLLLLLLL1 +1L00LLLLLLLLLLL1 +1L00LLLLLLLLLLL1 +1L000LLLLLLLLLL1 +1LL000LLLLLLLLL1 +1LLL0000LLLLLLL1 +1LLLL000000000L1 +1LLLLL00000000L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rD, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL00000LLLLLLL1 +1LL0000000LLLLL1 +1LL00LLL000LLLL1 +1LL00LLLL000LLL1 +1LL00LLLLL000LL1 +1LL00LLLLLL00LL1 +1LL00LLLLLL00LL1 +1LL00LLLLL000LL1 +1LL00LLLL000LLL1 +1LL00LLL000LLLL1 +1LL0000000LLLLL1 +1LL00000LLLLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rE, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rF, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL0000000000LL1 +1LL0000000000LL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LL00LLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rG, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LL0000000000LL1 +1L000000000000L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLLLLL1 +1L00LLLLLLLLLLL1 +1L00LLL000000LL1 +1L00LLL000000LL1 +1L00LLLLLLL00LL1 +1L00LLLLLLL00LL1 +1L00LLLLLLL00LL1 +1L00000000000LL1 +1LL000000000LLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rH, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L000000000000L1 +1L000000000000L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1L00LLLLLLLL00L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [rI, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1L000000000000L1 +1L000000000000L1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1LLLLLL00LLLLLL1 +1L000000000000L1 +1L000000000000L1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [background, bitmap` +1111111111111111 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1LLLLLLLLLLLLLL1 +1111111111111111`], + [extrabackground, bitmap` +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL +LLLLLLLLLLLLLLLL`], + [ship, bitmap` +................ +................ +.......1333..... +.......13333.... +.......1........ +.......1........ +.......1........ +.....11111111... +....11LL111111.. +....11LL1L1L111. +....11111111111. +1111111111111111 +.111111111111111 +..11L11L11L11L11 +...111111111111. +....11111111111.`], + [miss, bitmap` +................ +...2222222222... +..222222222222.. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +.22222222222222. +..222222222222.. +...2222222222... +................`], + [hit, bitmap` +33............33 +333..........333 +.333........333. +..333......333.. +...333....333... +....333..333.... +.....333333..... +......3333...... +......3333...... +.....333333..... +....333..333.... +...333....333... +..333......333.. +.333........333. +333..........333 +33............33`], + [emiss, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................`], //leave blank for actual run + [eposition, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................`], //leave blank for actual run + [eattack, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................`] +) +setBackground(background); + +setSolids([]) +//player spaces +// y 13 - 21 +// x 1 - 10 + +//enemy spaces +// y 2 - 11 +// x 1 - 10 + +let level = 0 +const levels = [ + map` +sssssssssss +s1234567890 +q.......... +w.......... +e.......... +r.......... +t.......... +y.......... +u.......... +i.......... +o.......... +sssssssssss +s1234567890 +qp......... +w.......... +e.......... +r.......... +t.......... +y.......... +u.......... +i.......... +o..........` +] + +setMap(levels[level]) + +setPushables({ + [ player ]: [] +}) + +onInput("w", () => { + moveUP() +}) +onInput("d", () => { + moveRP() +}) +onInput("a", () => { + moveLP() +}) +onInput("s", () => { + moveDP() +}) +onInput("l", () => { + placeAttack() +}) + +//player movement when placing ships +function moveRP(){ + getFirst(player).x += 1; +} +function moveLP(){ + getFirst(player).x -= 1; + if(getFirst(player).x < 1){ + getFirst(player).x = 10; + } +} + +function moveUP(){ + getFirst(player).y -= 1; + if(getFirst(player).y < 13 && getFirst(player).y >= 11){ + getFirst(player).y = 21; + }else if(getFirst(player).y < 2){ + getFirst(player).y = 10; + } +} + +function moveDP(){ + getFirst(player).y += 1; + if(getFirst(player).y > 10 && getFirst(player) <= 11){ + getFirst(player).y = 2; + } +} + +//places player ships/attacks +var ships = 17; +function placeAttack(){ + var x = getFirst(player).x; + var y = getFirst(player).y; + if(ships > 0 && getAll(ship).x != x && getAll(ship).y != y){ + ships -= 1; + addSprite(x,y, ship) + } + if(ships == 0 && getFirst(player).y >= 12){ + getFirst(player).x = 1; + getFirst(player).y = 2; + for(var i = 0; i < 16; i++){ + let xe = Math.floor(Math.random() * 10 + 1); + let ye = Math.floor(Math.random() * 10 + 2); + addSprite(xe, ye, eposition); + } + }else if(getFirst(player).y < 11){ + var xp = getFirst(player).x; + var yp = getFirst(player).y; + if(tilesWith(player, eposition).length > 0){ + clearTile(xp, yp); + addSprite(xp, yp, player); + addSprite(xp, yp, hit); + }else{ + addSprite(xp, yp, miss); + } + } + if(getFirst(player).y < 11){ + var ex = Math.floor(Math.random() * 10 + 1); + var ey = Math.floor(Math.random() * 9 + 13); + addSprite(ex, ey, eattack); + if(tilesWith(eattack, ship).length > 0){ + clearTile(ex, ey); + addSprite(ex, ey, hit); + }else{ + addSprite(ex, ey, emiss); + } + } + //win condition + if(tilesWith(eposition).length <= 0 && ships == 0){ + addText("YOU WIN!", { + x: 6, + y: 8, + color: color`7` + }) + }else if(tilesWith(ship).length == 0){ + addText("COMPUTER WINS!", { + x: 6, + y: 8, + color: color`3` + }) + } +} \ No newline at end of file From 6880a4a2f9ede47814bc6fb922fbd417995792e2 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Mon, 18 Dec 2023 07:11:57 -0600 Subject: [PATCH 09/11] Delete games/SprigbattleShip.js --- games/SprigbattleShip.js | 660 --------------------------------------- 1 file changed, 660 deletions(-) delete mode 100644 games/SprigbattleShip.js diff --git a/games/SprigbattleShip.js b/games/SprigbattleShip.js deleted file mode 100644 index 25bf55d263..0000000000 --- a/games/SprigbattleShip.js +++ /dev/null @@ -1,660 +0,0 @@ -/* -First time? Check out the tutorial game: -https://sprig.hackclub.com/gallery/getting_started -*/ - -// based on battleship - -//WASD (left side) to move and L (the button to the right on the right side) to place shipts and attack on specifyed spaces - -//17 ships (I dont know how to line them up like in real battleship so this is the next best thing) -//10x10 board (A-I)x(1-10) - -const player = "p" -const c1 = "1" -const c2 = "2" -const c3 = "3" -const c4 = "4" -const c5 = "5" -const c6 = "6" -const c7 = "7" -const c8 = "8" -const c9 = "9" -const c10 = "0" -const rA = "q" -const rB = "w" -const rC = "e" -const rD = "r" -const rE = "t" -const rF = "y" -const rG = "u" -const rH = "i" -const rI = "o" -const background = "a" -const extrabackground = "s" -const ship = "d" -const miss = "f" -const hit = "g" -const emiss = "j" -const eposition = "k" -const eattack = "l" - -setLegend( - [player, bitmap` -55555......55555 -5777........7775 -57............75 -57............75 -5..............5 -................ -................ -................ -................ -................ -................ -5..............5 -57............75 -57............75 -5777........7775 -55555......55555` ], - [c1, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLL0000LLLLLL1 -1LL000000LLLLLL1 -1LL000L00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1L000000000000L1 -1L000000000000L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c2, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLL00000LLLLL1 -1LLL0000000LLLL1 -1LL000LLL000LLL1 -1L000LLLLL000LL1 -1LLLLLLLL000LLL1 -1LLLLLLL000LLLL1 -1LLLLLL000LLLLL1 -1LLLLL000LLLLLL1 -1LLL0000LLLLLLL1 -1LL00000LLLLLLL1 -1L000000000000L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c3, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLL00000LLLLL1 -1LLL0000000LLLL1 -1LLLLLLL0000LLL1 -1LLLLLLLL000LLL1 -1LLLLLLL0000LLL1 -1LLLL000000LLLL1 -1LLLL000000LLLL1 -1LLLLLLL0000LLL1 -1LLLLLLLL000LLL1 -1LLLLLLL0000LLL1 -1LLL0000000LLLL1 -1LLLL00000LLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c4, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLL000LLLLLL1 -1LLLL0000LLLLLL1 -1LLL00L00LLLLLL1 -1LL00LL00LLLLLL1 -1L00LLL00LLLLLL1 -1L000000000000L1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c5, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1L000000000000L1 -1L000000000000L1 -1L00LLLLLLLLLLL1 -1L00LLLLLLLLLLL1 -1L000LLLLLLLLLL1 -1LL0000LLLLLLLL1 -1LLL00000000LLL1 -1LLLL00000000LL1 -1LLLLLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00000000000LL1 -1LL000000000LLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c6, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLL00000LLLLL1 -1LLL0000000LLLL1 -1LL000LLLLLLLLL1 -1L000LLLLLLLLLL1 -1L00LLLLLLLLLLL1 -1L0000000000LLL1 -1L000LLLLLL00LL1 -1L00LLLLLLLL0LL1 -1L00LLLLLLLL0LL1 -1L000LLLLLL00LL1 -1LL000LLLL00LLL1 -1LLL0000000LLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c7, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1L000000000000L1 -1L000000000000L1 -1LLLLLLLLLL000L1 -1LLLLLLLLL000LL1 -1LLLLLLLL000LLL1 -1LLLLLLL000LLLL1 -1LLLLLL000LLLLL1 -1LLLLL000LLLLLL1 -1LLLL000LLLLLLL1 -1LLL000LLLLLLLL1 -1LL000LLLLLLLLL1 -1L000LLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c8, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLL000000LLLL1 -1LLL00000000LLL1 -1LL00LLLLLL00LL1 -1LL0LLLLLLLL0LL1 -1LL00LLLLLL00LL1 -1LLL00000000LLL1 -1LLL00000000LLL1 -1LL00LLLLLL00LL1 -1LL0LLLLLLLL0LL1 -1LL00LLLLLL00LL1 -1LLL00000000LLL1 -1LLLL000000LLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c9, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLL000000LLLL1 -1LLL00LLLL00LLL1 -1LLL0LLLLLL0LLL1 -1LLL0LLLLLL0LLL1 -1LLL00LLLL00LLL1 -1LLLL0000000LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLL00LLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [c10, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL00LLL0000LLL1 -1LL00LL000000LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL00LL00LL1 -1LL00LL000000LL1 -1LL00LLL0000LLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rA, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLL0000LLLLL1 -1LLLL00LL00LLLL1 -1LLLL0LLLL0LLLL1 -1LLL00LLLL00LLL1 -1LLL00LLLL00LLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LL00LLLLLL00LL1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rB, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL0000LLLLLLLL1 -1LL000000LLLLLL1 -1LL00LLL00LLLLL1 -1LL00LLLL00LLLL1 -1LL00LLLL00LLLL1 -1LL0000000LLLLL1 -1LL00000000LLLL1 -1LL00LLLLL00LLL1 -1LL00LLLLLL00LL1 -1LL00LLLLLL00LL1 -1LL000000000LLL1 -1LL00000000LLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rC, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLLL00000000L1 -1LLLL000000000L1 -1LLL0000LLLLLLL1 -1LL000LLLLLLLLL1 -1L000LLLLLLLLLL1 -1L00LLLLLLLLLLL1 -1L00LLLLLLLLLLL1 -1L000LLLLLLLLLL1 -1LL000LLLLLLLLL1 -1LLL0000LLLLLLL1 -1LLLL000000000L1 -1LLLLL00000000L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rD, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL00000LLLLLLL1 -1LL0000000LLLLL1 -1LL00LLL000LLLL1 -1LL00LLLL000LLL1 -1LL00LLLLL000LL1 -1LL00LLLLLL00LL1 -1LL00LLLLLL00LL1 -1LL00LLLLL000LL1 -1LL00LLLL000LLL1 -1LL00LLL000LLLL1 -1LL0000000LLLLL1 -1LL00000LLLLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rE, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rF, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL0000000000LL1 -1LL0000000000LL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LL00LLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rG, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LL0000000000LL1 -1L000000000000L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLLLLL1 -1L00LLLLLLLLLLL1 -1L00LLL000000LL1 -1L00LLL000000LL1 -1L00LLLLLLL00LL1 -1L00LLLLLLL00LL1 -1L00LLLLLLL00LL1 -1L00000000000LL1 -1LL000000000LLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rH, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L000000000000L1 -1L000000000000L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1L00LLLLLLLL00L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [rI, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1L000000000000L1 -1L000000000000L1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1LLLLLL00LLLLLL1 -1L000000000000L1 -1L000000000000L1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [background, bitmap` -1111111111111111 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1LLLLLLLLLLLLLL1 -1111111111111111`], - [extrabackground, bitmap` -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL -LLLLLLLLLLLLLLLL`], - [ship, bitmap` -................ -................ -.......1333..... -.......13333.... -.......1........ -.......1........ -.......1........ -.....11111111... -....11LL111111.. -....11LL1L1L111. -....11111111111. -1111111111111111 -.111111111111111 -..11L11L11L11L11 -...111111111111. -....11111111111.`], - [miss, bitmap` -................ -...2222222222... -..222222222222.. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -.22222222222222. -..222222222222.. -...2222222222... -................`], - [hit, bitmap` -33............33 -333..........333 -.333........333. -..333......333.. -...333....333... -....333..333.... -.....333333..... -......3333...... -......3333...... -.....333333..... -....333..333.... -...333....333... -..333......333.. -.333........333. -333..........333 -33............33`], - [emiss, bitmap` -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................`], //leave blank for actual run - [eposition, bitmap` -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................`], //leave blank for actual run - [eattack, bitmap` -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................ -................`] -) -setBackground(background); - -setSolids([]) -//player spaces -// y 13 - 21 -// x 1 - 10 - -//enemy spaces -// y 2 - 11 -// x 1 - 10 - -let level = 0 -const levels = [ - map` -sssssssssss -s1234567890 -q.......... -w.......... -e.......... -r.......... -t.......... -y.......... -u.......... -i.......... -o.......... -sssssssssss -s1234567890 -qp......... -w.......... -e.......... -r.......... -t.......... -y.......... -u.......... -i.......... -o..........` -] - -setMap(levels[level]) - -setPushables({ - [ player ]: [] -}) - -onInput("w", () => { - moveUP() -}) -onInput("d", () => { - moveRP() -}) -onInput("a", () => { - moveLP() -}) -onInput("s", () => { - moveDP() -}) -onInput("l", () => { - placeAttack() -}) - -//player movement when placing ships -function moveRP(){ - getFirst(player).x += 1; -} -function moveLP(){ - getFirst(player).x -= 1; - if(getFirst(player).x < 1){ - getFirst(player).x = 10; - } -} - -function moveUP(){ - getFirst(player).y -= 1; - if(getFirst(player).y < 13 && getFirst(player).y >= 11){ - getFirst(player).y = 21; - }else if(getFirst(player).y < 2){ - getFirst(player).y = 10; - } -} - -function moveDP(){ - getFirst(player).y += 1; - if(getFirst(player).y > 10 && getFirst(player) <= 11){ - getFirst(player).y = 2; - } -} - -//places player ships/attacks -var ships = 17; -function placeAttack(){ - var x = getFirst(player).x; - var y = getFirst(player).y; - if(ships > 0 && getAll(ship).x != x && getAll(ship).y != y){ - ships -= 1; - addSprite(x,y, ship) - } - if(ships == 0 && getFirst(player).y >= 12){ - getFirst(player).x = 1; - getFirst(player).y = 2; - for(var i = 0; i < 16; i++){ - let xe = Math.floor(Math.random() * 10 + 1); - let ye = Math.floor(Math.random() * 10 + 2); - addSprite(xe, ye, eposition); - } - }else if(getFirst(player).y < 11){ - var xp = getFirst(player).x; - var yp = getFirst(player).y; - if(tilesWith(player, eposition).length > 0){ - clearTile(xp, yp); - addSprite(xp, yp, player); - addSprite(xp, yp, hit); - }else{ - addSprite(xp, yp, miss); - } - } - if(getFirst(player).y < 11){ - var ex = Math.floor(Math.random() * 10 + 1); - var ey = Math.floor(Math.random() * 9 + 13); - addSprite(ex, ey, eattack); - if(tilesWith(eattack, ship).length > 0){ - clearTile(ex, ey); - addSprite(ex, ey, hit); - }else{ - addSprite(ex, ey, emiss); - } - } - //win condition - if(tilesWith(eposition).length <= 0 && ships == 0){ - addText("YOU WIN!", { - x: 6, - y: 8, - color: color`7` - }) - }else if(tilesWith(ship).length == 0){ - addText("COMPUTER WINS!", { - x: 6, - y: 8, - color: color`3` - }) - } -} \ No newline at end of file From 18722f65c822e54188198c5e882d80be381289d9 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Tue, 19 Dec 2023 07:02:26 -0600 Subject: [PATCH 10/11] Update Hard-Hat Helper.js --- games/Hard-Hat Helper.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/games/Hard-Hat Helper.js b/games/Hard-Hat Helper.js index d0633379be..5e9248f444 100644 --- a/games/Hard-Hat Helper.js +++ b/games/Hard-Hat Helper.js @@ -369,7 +369,18 @@ w.ttt.w weg...w www..ew wr..www -wwfs..w` //10 +wwfs..w`, //10 + map ` +.......... +.wwww..w.w +..w.www.w. +..w.w.ww.w +.......... +.......... +.......... +.......... +wr.......w +wwwwwwwwww` ] setMap(levels[level]); setSolids([platformON, playerR, playerL, wall, spring, platform, lBelt, rBelt]); From b9ee61c3a8c55f6bde211524501cf8ecb2c02676 Mon Sep 17 00:00:00 2001 From: NathanJereb2 <97325443+NathanJereb2@users.noreply.github.com> Date: Wed, 20 Dec 2023 07:06:37 -0600 Subject: [PATCH 11/11] Rename Hard-Hat Helper.js to Hard-Hat_Helper.js --- games/{Hard-Hat Helper.js => Hard-Hat_Helper.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename games/{Hard-Hat Helper.js => Hard-Hat_Helper.js} (100%) diff --git a/games/Hard-Hat Helper.js b/games/Hard-Hat_Helper.js similarity index 100% rename from games/Hard-Hat Helper.js rename to games/Hard-Hat_Helper.js