diff --git a/games/V6.js b/games/V6.js new file mode 100644 index 0000000000..3382aabccb --- /dev/null +++ b/games/V6.js @@ -0,0 +1,762 @@ + +/* +@title: V6 Block and friend +@author: TNL_Name? +@tags: [] +@addedOn: 2025-00-00 +*/ + +//keep in mind when you go through the levels if a wall won't let you through shove player1 through the wall with player2 +// later add health +const player = "p" +const box = "b" +const wall = "w" +const wall2 = "W" +const Wflag = "f" +const swordkey = "d" +const swordkey2 = "D" +const box2 = "n" +const tree = "t" +const player2 = "P" +const forest_mid = "v" +const neutral_path = "V" +const path_sideways = "i" +const keylock = "L" +const keylock2 = "l" +const basement = "T" +const basement_up = "^" +const path_vertical = "F" +const house = "h" +const door = "H" +const death_block = "_" +const house_floor = "-" +const push_key = "/" +const push_lock = "+" +const push_key_lock_block = "%" +//make multiple sprites for variation +//create a proper forest for game +//add houses to enter + + +setLegend( + [ player, bitmap` +................ +................ +................ +................ +................ +.....0LL111..... +.....0D4221..... +.....0D4241..... +.....0D444L..... +.....0DDDDL..... +.....000000..... +................ +................ +................ +................ +................` ], + [ box, bitmap` +................ +................ +................ +................ +....00000000.... +....0DFF6220.... +....0FDD4420.... +....0FDF6460.... +....0FDF6460.... +....0FDDD460.... +....0DFFF640.... +....00000000.... +................ +................ +................ +................` ], + [ wall, bitmap` +LLLLLL5LLLLLLLLL +L114425441122L2L +L144425177112L1L +L74411D117744L1L +L7LLLLDD5545451L +L772L112L112244L +4441L111L111254D +5477L111L1114D1L +445D555LLLLLDD5D +444422D41111742L +L11112D44117712L +L11111DD4144111L +LLLLLLL5D55LLLLL +L112L1771251112L +L144L1441151111L +LDDD555LL4D5LLLL`], + [wall2, bitmap` +LLLLLLLLLLLLLLLL +L111122L112L112L +L111112L111L111L +L111111L111L111L +LLLLLLLLLLLLLLLL +L1122L12L111222L +L1112L11L111112L +L1111L11L111111L +LLLLLLLLLLLLLLLL +L2L1112L1111222L +L1L1111L1111112L +L1L1111L1111111L +LLLLLLLLLLLLLLLL +L1112L111112L12L +L1111L111111L11L +LLLLLLLLLLLLLLLL`], + [ Wflag, bitmap` +................ +................ +................ +....668HH....... +.....68H882..... +.....68H888..... +.....68H8882.... +.....68H888H.... +.....66HH88H.... +.....6....HH.... +.....6.......... +.....6.......... +.....6.......... +....66.......... +................ +................` ], + [ swordkey, bitmap` +................ +.......L4....... +.......D4....... +.......D1....... +.....L11111..... +.....LLL1LL..... +.......L1....... +.......L1....... +.......L1....... +.......L1....... +.......D1....... +.......D4....... +.......D4....... +......D441...... +....D1144444.... +...D444444414...` ], + [ tree, bitmap` +................ +................ +................ +................ +.....H88........ +....HH8826...... +...HH888828..... +.HHH888H8888.... +.HH8888HH88888.. +..HHHHHHH88HHH.. +...C99..HHHH.... +.HH8889......... +.H88HC9......... +..HH.C99........ +....CCC99....... +...CCCCCCC9.....` ], + [ box2, bitmap` +................ +................ +................ +................ +....00000000.... +....05FF6220.... +....0F557720.... +....0F5F6760.... +....0F5F6760.... +....0F555760.... +....05FFF670.... +....00000000.... +................ +................ +................ +................` ], + [ player2, bitmap` +................ +................ +................ +................ +....00000000.... +....05777220.... +....05777720.... +....05772770.... +....05777770.... +....05777770.... +....05555550.... +....00000000.... +................ +................ +................ +................`], + [ keylock, bitmap` +................ +................ +................ +................ +.....F66622..... +....F66..F62.... +....F6....F6.... +....F6....F6.... +...0111111122... +...01110L2112... +...011100L111... +...0111101111... +...0L11101111... +...0LL1111111... +...0000000000... +................`], + [ basement, bitmap` +................ +................ +................ +................ +................ +....F......C.... +...0F000000C0... +..00FFFCCCCC00.. +..00F000000C00.. +..00F000000C00.. +..00FFFFFFFC00.. +...0F000000C0... +................ +................ +................ +................`], + [ basement_up, bitmap` +................ +....000000000... +....000000000... +....000000000... +.....FFFFFFF.... +.....F.....F.... +.....FFFFFFF.... +.....F.....F.... +.....F.....F.... +....0FFFFFFF.... +....0F00...F.... +.....F00000F.... +.....F00000F.... +................ +................ +................`], + [ keylock2, bitmap` +................ +................ +................ +................ +.....577722..... +....577..572.... +....57....57.... +....57....57.... +...0111111122... +...01110L2112... +...011100L111... +...0111101111... +...0L11101111... +...0LL1111111... +...0000000000... +................`], + [ swordkey2, bitmap` +................ +................ +................ +................ +.......51....... +.......51....... +......5111...... +.......51....... +.......51....... +.......51....... +.......51....... +.......51....... +.......51....... +.......51....... +....51111111.... +...5111111111...` ], + [forest_mid, bitmap` +444444444D444444 +D44D4444444444D4 +4444444444444444 +44444D4444D444D4 +4444444444444444 +4D4444D444444D44 +44444444D4D44444 +444D444444444444 +4444D444D44444D4 +444D444444444444 +444444444444D444 +D444444D44444444 +4444444444444444 +44D4D44444D444D4 +4444444D4444D444 +4444444444444444`], + [house, bitmap` +................ +................ +.9F9F999999F9F9. +.9F9F999999F9F9. +.9F9F999999F9F9. +.9F9FCCCCCCF9F9. +.9F9999999999F9. +.9FCCCCCCCCCCF9. +.9FFFFFFFFFFFF9. +.9CCCCCCCCCCCC9. +.99999999999999. +..LLLLLLLLLLLL.. +..L1111111111L.. +..LLLLLLLLLLLL.. +..L1111111111L.. +................`], + [door, bitmap` +.....L11111L.... +.....1111111.... +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................`], + [death_block, bitmap` +................ +................ +................ +................ +................ +..LLLLLLLLLLLL.. +.L000000000000L. +L00000000000000L +L00000000000000L +.L000000000000L. +..LLLLLLLLLLLL.. +................ +................ +................ +................ +................`], + [house_floor, bitmap` +FFFFFFFFFFFFFFFF +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FC9999999999999F +FCCCCCCCCCCCCCCF +FFFFFFFFFFFFFFFF`], + [push_key, bitmap` +................ +................ +................ +.....LL11111.... +....LL1116111... +...LL111666111.. +...LL111666111.. +...LL111161111.. +...LL111161111.. +...LL111161111.. +...LL111666111.. +....LL1116111... +.....LL11111.... +................ +................ +................`], + [push_lock, bitmap` +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +..66666666666... +.6111111LLLL06.. +.61111LLL00006.. +.611LLL0000006.. +..66666666666... +................`], + [push_key_lock_block, bitmap` +LLLLLLLLLLLLLLLL +L111122661122L2L +L111112661112L1L +L111116666111L1L +LLLLLLL66LLLLLLL +L112L1166111122L +L111L6666661112L +L111L6666661111L +LLLLLLL66LLLLLLL +L11112266111122L +L11111666611112L +L11111666611111L +LLLLLL6666LLLLLL +L11122L66111122L +L11111L11111111L +LLLLLLLLLLLLLLLL`], + [path_vertical, bitmap` +6FFFFFFFFFFF6FFF +F6F6FFFFFFFFFF6F +FFFFFFFFFFFFFF6F +F6FFFFFFFFFFFFFF +FFFFFFFFFFFF6F6F +6F6FFFFFFFFFFFFF +FFFFFFFFFFFFFFF6 +FFFF6FFFFFFF66FF +FF6FFFFFFFFFFFFF +FFFFFFFFFFFFFF6F +F6FFFFFFFFFFF6FF +FFF6FFFFFFFFFFF6 +6FFFFFFFFFFF6FFF +FFFFFFFFFFFFFF6F +FFF6FFFFFFFFF6FF +F6FFFFFFFFFFFFF6`], + [path_sideways,bitmap` +F6FFFFFF6FFFF6FF +FFFFFF6FFFF6FFFF +FF6FF6FF6FFF6F6F +F6FFFFFFFFFFFFFF +FFFFFFF6FFF6FFFF +FFFFFFFFFFFFFF6F +F6FFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF +FFFFFFF6FFF6FFFF +FF6FFFFFFFFFFF6F +6FFF6FFFFFF6FFFF +FFFFFFFF6FFFFF6F +6FF6FF6FFF6FFFFF`], + [neutral_path, bitmap` +6FDDDFDDFDF4F66F +FF6FFF4FD6FF4F4F +FFFF6FFFFF6FFFF4 +46FFFFF6FFFFF66D +4F6FFFFFFFFFFFFD +4FFFFFFFFFFF6FFD +D466FFFFFFFFFF64 +D4FFFFFFFFFFFFDF +D6FF6FFFFFFFFFF6 +4FFFFFFFFFFFFFFF +4FF6FFFFFFFF6F44 +4FFFFFFFFFFFFF6F +4FFF6FFFFFFFFFFD +4F6FF6FF6FFF6F4F +F6F6FF44DF6FFFDD +FD4D44DD4F44DFF6`] + +) + +setSolids([player, box, wall, wall2, keylock, tree, box2, player2, keylock2, push_key, push_key_lock_block]) + +let level = 0 +const levels = [ + map` +..b...f +.w.wWwL +.W..... +pwP.n_. +hwWw... +WWd.... +Wtt....`, + map` +..ttWWWWW..... +..ttW.fWW....b +...dW..WW../.b +.t.tW..WW....b +..t.W..L%bn.bb +...tW..WW..bbb +WWFWwW.WWbnnb. +...twwWWW.bb.. +....t...tt.... +P..tt.Viii.... +t..tt.F.tt.... +p.._iiV+tt.... +h..ttttttt.... +......tt......`, + map ` +f.W........... +..W........... +.WW........... +.W............ +bW............ +.WW........... +n.W........... +..WW.......... +..WW.......... +WwWWwWwwLWWWwW +WWwwWWWWWWwwWw +w............. +p.WW.......... +PW.W........d.`, +map` +fWw......d +.%L....... +wWw....... +..b....... +b.bb...... +..b....... +t+tttt.... +WWWWWwWFFw +pVWWP/.FF. +hViiiiiVV.`, +map` +...WWW........%..f +P....W/......WWWWW +p...WW............ +h..WW............. ++..W..............`] + +let sublevel = -1 +const sublevels = [ + map` +..H.. +.Tp.. +..... +..... +..... +..... +.....`, + map` +.... +..p^`, + + ] + + + +setMap(sublevels[0]) + +setMap(levels[0]) + + +setPushables({ + [ player ]: [box, player, push_key], + [ box ]: [box, push_key], + [ box2 ]: [box2, player, push_key], + [ player2 ]: [box2, player, push_key], + +}) + + + +onInput("a", () => { + clearText() + getFirst(player).x -= 1 +}) + +onInput("d", () => { + clearText() + getFirst(player).x += 1 +}) + +onInput("s", () => { + clearText() + getFirst(player).y += 1 +}) + +onInput("w", () => { + clearText() + getFirst(player).y -= 1 +}) + +// double dash from here down onInput lines for second player + +onInput("j", () => { + clearText() + getFirst(player2).x -= 2 +}) + +onInput("l", () => { + clearText() + getFirst(player2).x += 2 +}) + +onInput("i", () => { + clearText() + getFirst(player2).y -= 2 +}) + +onInput("k", () => { + clearText() + getFirst(player2).y += 2 +}) + +afterInput(() => { +}) + +// level switch check and code +afterInput(() => { + + const win = tilesWith(player, Wflag) + if (win.length >= 1){ + if (level < levels.length - 1) { + level = level + 1; + setMap(levels[level]); + }else{ + addText("You Win!", { x: 6, y: 1, color: color`4` }); +setTimeout(()=>{ + window.open("https://docs.google.com/document/d/19AoDjOnayW5170jqFZeFFfvvlIY-PiZfC2jZaHNviOc/edit?tab=t.0"); +},250) + }}}) +afterInput(() => { + const enter = tilesWith(player, house) + if (enter.length >= 1){ + sublevel = sublevel + 1; + setMap(sublevels[sublevel]) + setBackground(house_floor) + }}) + + afterInput(() => { + + setTimeout(() =>{ + const exit = tilesWith(player, door) + if (exit.length >= 1){ + level = level; + sublevel = sublevel - 1; + setMap(levels[level]) + setBackground() }},250) + }) + + afterInput(() => { + + setTimeout(() =>{ + const enter_basement = tilesWith(player, basement) + if (enter_basement.length >= 1){ + sublevel = sublevel + 1; + setMap(sublevels[sublevel]) + setBackground(house_floor) }},250) + }) + + + afterInput(() => { + + setTimeout(() =>{ + const exit_basement = tilesWith(player, basement_up) + if (exit_basement.length >= 1){ + level = level; + sublevel = sublevel - 1; + setMap(sublevels[sublevel]) + setBackground(house_floor) }},250) + }) + + + + /* WflagSprites.forEach(Wflag => { + if (playerSprite.x === Wflag.x && playerSprite.y === Wflag.y) { + }) +}) checks to see if the spritew are in the same tile then preforms action can be used in many ways*/ + + + + +afterInput(() => { + const lockgone = tilesWith(player, swordkey); + if (lockgone.length >= 1) /* lockgone.length increases when player/swordkey touch and if it = or is more than 1 triggers the next code line*/ + { + getFirst(keylock).remove(); + getFirst(swordkey).remove(); + + } + }) + +afterInput(() => { + const lockgone2 = tilesWith(player2, swordkey2); + if (lockgone2.length >= 1) /* lockgone.length increases when player/swordkey touch and if it = or is more than 1 triggers the next code line*/ + { + getFirst(keylock2).remove(); + getFirst(swordkey2).remove(); + + } + }) + + +afterInput(() => { + const push_key_destroy = tilesWith(push_key, push_lock); + if (push_key_destroy.length >= 1) // push_key will touch hole deleting all three sprites + { + getFirst(push_key).remove(); + getFirst(push_lock).remove(); + getFirst(push_key_lock_block).remove(); + } + }) + + + +afterInput(() => { + +setTimeout(() => { + const kill = tilesWith(player, death_block); + if (kill.length >= 1){ +level = level + setMap(levels[level]) + }},100) +}) + +afterInput(() => { + +setTimeout(() => { + const kill2 = tilesWith(player, push_lock); + if (kill2.length >= 1){ +level = level + setMap(levels[level]) + }},100) +}) + + +addText("welcome", { + x: 6, + y: 1, + color: color`H`, +}) + +addText("to", { + x: 8, + y: 3, + color: color`H`, +}) + +addText("block", { + x: 7, + y: 5, + color: color`H`, +}) + +addText("and", { + x: 8, + y: 7, + color: color`H`, +}) + +addText("friends ", { + x: 6, + y: 9, + color: color`H`, +}) + +/*if (level == 0) { +addSprite(2, 3, player) +addSprite(2, 5, player2)*/ + + + diff --git a/games/img/V6.png b/games/img/V6.png new file mode 100644 index 0000000000..07f959c683 Binary files /dev/null and b/games/img/V6.png differ