diff --git a/Games/Pathways/.gitignore b/Games/Pathways/.gitignore new file mode 100644 index 0000000000..f879b3569d --- /dev/null +++ b/Games/Pathways/.gitignore @@ -0,0 +1,3 @@ +CourseworkAWD_NOV2020.pdf +/Old Original Game +/README.txt \ No newline at end of file diff --git a/Games/Pathways/README.md b/Games/Pathways/README.md new file mode 100644 index 0000000000..b83f040e3b --- /dev/null +++ b/Games/Pathways/README.md @@ -0,0 +1,24 @@ +# Pathways - The Maze Game + +# [Game Interface] + +## **Description 📃** + +This is simply a Maze game where you have to start from one point and go to the finish point as fast as you can! + +## LEVEL & DIFFICULTIES + +There are 5 levels in total & each new level increases the difficulty! + +## **How to play? 🕹ī¸** + +You have to use your **W,S,A,D** keys (_W - UP_, _S - DOWN_, _A - LEFT_, _D - RIGHT_) to navigate throught the maze! + +### Made By: `Pujan Sarkar` + +# [Game Interface] + +## **Screenshots 📸** + +
+ # [Game image] \ No newline at end of file diff --git a/Games/Pathways/assets/huge.gif b/Games/Pathways/assets/huge.gif new file mode 100644 index 0000000000..56445f1eb8 Binary files /dev/null and b/Games/Pathways/assets/huge.gif differ diff --git a/Games/Pathways/assets/large.gif b/Games/Pathways/assets/large.gif new file mode 100644 index 0000000000..1b15a34475 Binary files /dev/null and b/Games/Pathways/assets/large.gif differ diff --git a/Games/Pathways/assets/medium.gif b/Games/Pathways/assets/medium.gif new file mode 100644 index 0000000000..d2c8a8b823 Binary files /dev/null and b/Games/Pathways/assets/medium.gif differ diff --git a/Games/Pathways/assets/normal.gif b/Games/Pathways/assets/normal.gif new file mode 100644 index 0000000000..461a5234e1 Binary files /dev/null and b/Games/Pathways/assets/normal.gif differ diff --git a/Games/Pathways/assets/small.gif b/Games/Pathways/assets/small.gif new file mode 100644 index 0000000000..ea9f109112 Binary files /dev/null and b/Games/Pathways/assets/small.gif differ diff --git a/Games/Pathways/index.html b/Games/Pathways/index.html new file mode 100644 index 0000000000..a4b98953f4 --- /dev/null +++ b/Games/Pathways/index.html @@ -0,0 +1,115 @@ + + + + + Pathways + + + + + + +
+
+
+ + Player - Get the best finish time! + +
+
+
+
+ Pathways is simply a Maze game where you have to start from one + point and go to the finish point as fast as you can! +

+ LEVEL & DIFFICULTIES
+ There are 5 levels in total & each new level increases the difficulty! +

+ INSTRUCTION
+ You have to use your W,S,A,D keys (W - UP, S - DOWN, A - LEFT, D - + RIGHT) to navigate throught the maze! +
+
+
+
+ +
+
+
+
+
+ Player Name: + +
+
+ Time: +
+
+ Level: +
+
+
+
+
+ + This text is displayed if your browser does not support HTML5 + Canvas. + +
+
+
+
+
Final Result
+
+
+
+
+ + + + + + diff --git a/Games/Pathways/script.js b/Games/Pathways/script.js new file mode 100644 index 0000000000..5b74124217 --- /dev/null +++ b/Games/Pathways/script.js @@ -0,0 +1,251 @@ +let images = [ + { + src: "./assets/small.gif", + size: 260, + collisionLT: 24, + collisionRB: 225, + startY: 110, + startX: 25, + win: { + x: 45, + y: 225, + }, + }, + { + src: "./assets/normal.gif", + size: 348, + collisionLT: 24, + collisionRB: 310, + startY: 114, + startX: 25, + win: { + x: 310, + y: 204, + }, + }, + { + src: "./assets/medium.gif", + size: 436, + collisionLT: 24, + collisionRB: 402, + startY: 25, + startX: 332, + win: { + x: 402, + y: 180, + }, + }, + { + src: "./assets/large.gif", + size: 503, + collisionLT: 24, + collisionRB: 470, + startY: 465, + startX: 112, + win: { + x: 132, + y: 470, + }, + }, + { + src: "./assets/huge.gif", + size: 570, + collisionLT: 24, + collisionRB: 530, + startY: 530, + startX: 311, + win: { + x: 201, + y: 25, + }, + }, +]; + +var score = []; + +var canvas; +var ctx; +var dx = 5; +var dy = 5; +var x = images[0].startX; +var y = images[0].startY; +var WIDTH = 2600; +var HEIGHT = 2600; +var img = new Image(); +var collision = 0; +var level = 1; + +var clock = 0; + +function rect(x, y, w, h) { + ctx.beginPath(); + ctx.rect(x, y, w, h); + ctx.closePath(); + ctx.fill(); +} + +function clear() { + ctx.clearRect(0, 0, WIDTH, HEIGHT); + ctx.drawImage(img, 0, 0); +} + +function reset() { + totalSeconds = -1; + score = []; + + canvas; + ctx; + dx = 5; + dy = 5; + x = images[0].startX; + y = images[0].startY; + WIDTH = 2600; + HEIGHT = 2600; + img = new Image(); + collision = 0; + level = 1; + + clock = 0; + + document.getElementById("canvasRow").classList.remove("hide"); + document.getElementById("totalDisplay").innerHTML = ""; + const timerDiv = document.getElementById("timerDivHide"); + timerDiv.classList.remove("hide"); +} + +function init() { + reset(); + startTimer(); + canvas = document.getElementById("canvas"); + ctx = canvas.getContext("2d"); + img.src = images[0].src; + ctx.canvas.width = images[0].size; + ctx.canvas.height = images[0].size; + return setInterval(draw, 10); +} + +function nextLevel(index) { + x = images[index].startX; + y = images[index].startY; + canvas = document.getElementById("canvas"); + ctx = canvas.getContext("2d"); + img.src = images[index].src; + ctx.canvas.width = images[index].size; + ctx.canvas.height = images[index].size; + const time = totalSeconds; + score.push(time); + var totalDisplay = document.getElementById("totalDisplay"); + totalDisplay.innerHTML += `Level ${index} - Time taken = ${time}
`; + totalSeconds = -1; + return setInterval(draw, 10); +} + +function doKeyDown(evt) { + switch (evt.keyCode) { + case 87 /* Up arrow was pressed */: + if (y - dy > 0) { + y -= dy; + clear(); + checkcollision(); + if (collision == 1) { + y += dy; + collision = 0; + } + } + + break; + case 83 /* Down arrow was pressed */: + if (y + dy < HEIGHT) { + y += dy; + clear(); + checkcollision(); + if (collision == 1) { + y -= dy; + collision = 0; + } + } + + break; + case 65 /* Left arrow was pressed */: + if (x - dx > 0) { + x -= dx; + clear(); + checkcollision(); + if (collision == 1) { + x += dx; + collision = 0; + } + } + break; + case 68 /* Right arrow was pressed */: + if (x + dx < WIDTH) { + x += dx; + clear(); + checkcollision(); + if (collision == 1) { + x -= dx; + collision = 0; + } + } + break; + } +} + +function checkcollision() { + var imgd = ctx.getImageData(x, y, 15, 15); + var pix = imgd.data; + for (var i = 0; (n = pix.length), i < n; i += 4) { + if (pix[i] == 0) { + collision = 1; + } + } + + var index = level - 1; + console.log(index); + console.log(x, y, images[index].win.x, images[index].win.y); + + if (x < images[index].collisionLT) { + collision = 1; + } else if (y < images[index].collisionLT) { + collision = 1; + } else if (x > images[index].collisionRB) { + collision = 1; + } else if (y > images[index].collisionRB) { + collision = 1; + } else if (x == images[index].win.x && y == images[index].win.y) { + if (index + 1 >= images.length) { + document.getElementById("canvasRow").classList.add("hide"); + document.getElementById("timerDivHide").classList.add("hide"); + var totalDisplay = document.getElementById("totalDisplay"); + score.push(totalSeconds); + let total = 0; + score.forEach((element) => { + total += element; + }); + totalDisplay.innerHTML += `Final Level - Time taken = ${totalSeconds}`; + totalDisplay.innerHTML += `
Total Time Taken to complete all the maze is ${total}`; + totalDisplay.innerHTML += `
Can you do better? `; + } else { + level++; + document.getElementById("level").innerHTML = level; + nextLevel(index + 1); + } + } +} + +function draw() { + clear(); + ctx.strokeStyle = "#09f"; + ctx.fillStyle = "rgba(225, 0, 0, 0.5)"; + rect(x, y, 15, 15); +} + +function startTheGame() { + var name = prompt("Please enter your name"); + document.getElementById("name").innerHTML = name; + document.getElementById("gameInfo").classList.add("hide"); + document.getElementById("btnStart").classList.add("hide"); + init(); + document.getElementById("canvasRow").classList.remove("hide"); + window.addEventListener("keydown", doKeyDown, true); +} diff --git a/Games/Pathways/style.css b/Games/Pathways/style.css new file mode 100644 index 0000000000..acb996c465 --- /dev/null +++ b/Games/Pathways/style.css @@ -0,0 +1,88 @@ +.cardStyle { + background-color: #15405e; + -webkit-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + border-radius: 6px; +} +canvas { + border-radius: 10px; + -webkit-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); +} + +:root { + --bg-color: #080808; + --second-bg-color: #001005; + --text-color: white; + --main-color: #00ff51; +} + +#timeTitle { + font-size: 2.5rem; + font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", + "Lucida Sans", Arial, sans-serif; + color: white; +} + +.totalStyle { + background-color: var(--main-color); + -webkit-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + border-radius: 6px; + margin-top: 5%; + padding: 2%; + margin-bottom: 5%; +} + +#name, +#level, +#seconds { + color: #15405e; + font-size: 2rem; + font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", + "Lucida Sans", Arial, sans-serif; +} + +.totalTile { + color: var(--main-color); + font-size: 2rem; + font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", + "Lucida Sans", Arial, sans-serif; + color: white; +} + +#totalDisplay { + font-size: 1.5rem; + font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", + "Lucida Sans", Arial, sans-serif; +} + +#timerDiv { + background-color: var(--main-color); + -webkit-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + box-shadow: 4px 3px 18px -1px rgba(0, 0, 0, 0.75); + border-radius: 6px; + margin-top: 4%; + padding: 1%; +} + +.gameTitleDiv { + font-size: 3rem; + font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", + "Lucida Sans", Arial, sans-serif; +} + +#timeTook { + color: var(--main-color) ; +} + +.hide { + height: 0; + padding: 0; + margin: 0; + visibility: hidden; +} diff --git a/README.md b/README.md index 3e2dbcf63e..25705daad9 100644 --- a/README.md +++ b/README.md @@ -775,14 +775,26 @@ This repository also provides one such platforms where contributers come over an | [Penguins Can't Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Can't_Fly) | | [Intellect Quest](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Intellect_Quest) | | [Number_Guessing_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Guessing_Game) | + +| [Tower_Block_Game](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Tower_Block_Game) | + + | [Currency_Converter](https://github.com/kunjgit/GameZone/tree/main/Games/Currency_Converter) | | [mario-game](https://github.com/kunjgit/GameZone/tree/main/Games/mario-game) | | [Fruit_Slicer_Game] (https://github.com/narayani9120/GameZone_B/tree/main/Games/Fruit_Slicer_Game) | | [Tower_Block_Game](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Tower_Block_Game) | + | [Modulo_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Modulo_Game) | | [Memory_Matching_Game](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Memory_Matching_Game) | |[Penguins Can't Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Can't_Fly)| | [Block_Ninja] (https://github.com/kunjgit/GameZone/tree/main/Games/Block_Ninja) | + + + + + + + | [Shoot_Duck_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Shoot_Duck_Game) | | [Disney_Trivia](https://github.com/manmita/GameZone/tree/Disney_Trivia/Games/Disney_Trivia)| |[puzzle-game](https://github.com/kunjgit/GameZone/tree/main/Games/puzzle-game)| @@ -807,6 +819,7 @@ This repository also provides one such platforms where contributers come over an |[Wheel_of_Fortunes](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Wheel_of_Fortunes)| |[Tic-tac-toe](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Tic-tac-toe)| |[Quest_For_Riches](https://github.com/kunjgit/GameZone/tree/main/Games/Quest_For_Riches)| +
diff --git a/assets/images/Pathways.png b/assets/images/Pathways.png new file mode 100644 index 0000000000..95aba6c251 Binary files /dev/null and b/assets/images/Pathways.png differ diff --git a/assets/index_old.html b/assets/index_old.html index cd29c4bbfc..7bf077237b 100644 --- a/assets/index_old.html +++ b/assets/index_old.html @@ -2778,9 +2778,15 @@

Gessing The song by emoji as a hint with 5 Chances.

+ + +
  • + +
  • +
    + game thumbnail +
    +

    144.Pathways

    +

    This is simply a Maze game where you have to start from one point and go to the finish point as fast as you can!

    + +
  • + + + game thumbnail @@ -2799,6 +2815,7 @@

    + diff --git a/assets/js/gamesData.json b/assets/js/gamesData.json index ef609c568f..3b52d8ee2c 100644 --- a/assets/js/gamesData.json +++ b/assets/js/gamesData.json @@ -2000,6 +2000,120 @@ "thumbnailUrl": "Dot_Connect.png" }, + +}, + +"396":{ + "gameTitle": "path finder puzzle", + "gameUrl": "path_finder", + "thumbnailUrl": "pathfinder.png" +}, +"414":{ + "gameTitle": "NameFate", + "gameUrl": "namefate", + "thumbnailUrl": "namefate.png" +} +, +"500":{ + "gameTitle": "Menja block breaker", + "gameUrl": "Menja_block_breaker", + "thumbnailUrl": "menja_Block_breaker.png" +}, +"393":{ + + "gameTitle": "Pop My Balloon", + "gameUrl": "Pop_My_Balloon", + "thumbnailUrl": "Pop_My_Balloon.png" + +}, +"397":{ + "gameTitle": "Tower Stack", + "gameUrl": "Tower_Stack", + "thumbnailUrl": "Tower_Stack.png" + +}, +"395":{ + + "gameTitle": "Virtual Pet Game", + "gameUrl": "Virtual_Pet_Game", + "thumbnailUrl": "Virtual_Pet_Game.png" + + "gameTitle": "path finder puzzle", + "gameUrl": "path_finder", + "thumbnailUrl": "pathfinder.png" +}, +"411":{ "gameTitle": "Tiny Fishing", +"gameUrl": "Tiny_Fishing", +"thumbnailUrl": "Tiny_Fishing.png" +}, +"398":{ +"410":{ + "gameTitle": "Shrek Vs Wild", + "gameUrl": "Shrek_Vs_Wild", + "thumbnailUrl": "Shrek_Vs_Wild.png" +}, +"409":{ + "gameTitle": "Hover_Board_Effect", + "gameUrl": "Hover_Board_Effect", + "thumbnailUrl": "Hover_Board_Effect.png" +}, +"405":{ + "gameTitle": "Candy_Crush_Saga", + "gameUrl": "Candy_Crush_Saga", + "thumbnailUrl": "Candy_Crush_Saga.png" +},"419":{ + + "gameTitle": "16_Puzzle", + "gameUrl": "16_Puzzle", + "thumbnailUrl": "16_Puzzle.png" +}, +"420":{ + "gameTitle" : "Colour_Generator_Game", + "gameUrl": "Colour_Generator_Game", + "thumbnailUrl": "Colour_Generator_Game.png" + }, +"406":{ + "gameTitle": "Knife_hit", + "gameUrl": "Knife_hit", + "thumbnailUrl": "Knife_hit.png" +},"415":{ + "gameTitle": "Anagram_Checker_Game", + "gameUrl": "Anagram_Checker_Game", + "thumbnailUrl": "Anagram_Checker_Game.png" + +}, +"407":{ + "gameTitle": "Screen_Pet_Game", + "gameUrl": "Screen_Pet_Game", + "thumbnailUrl": "Screen_Pet_Game.png" + +},"416":{ + "gameTitle": "Guess_The_Song", + "gameUrl": "Guess_The_Song", + "thumbnailUrl": "Guess_The_Song.png" + } +},"408":{ + "gameTitle": "Brick Buster", + "gameUrl": "Brick Buster", + "thumbnailUrl": "Brick.png" + + } + }, + "417":{ + "gameTitle": "Soccer", + "gameUrl": "Soccer", + "thumbnailUrl": "Soccer" +}, +"409":{ + "gameTitle": "Pathways", + "gameUrl": "Pathways", + "thumbnailUrl": "Pathways.png" + }, +"409":{"gameTitle": "Pen_Pointer_Fight", +"gameUrl": "PenPointerFight", +"thumbnailUrl": "PenPointerFight.png" +}, + "398": { "gameTitle": "path finder puzzle", "gameUrl": "path_finder", @@ -2100,6 +2214,7 @@ "gameUrl": "MathQuiz", "thumbnailUrl": "MathQuiz.png" }, + "418":{ "gameTitle": "MathQuiz", "gameUrl": "MathQuiz", @@ -2110,14 +2225,18 @@ "gameUrl":"puzzle-game", "thumbnailUrl":"puzzle-game.png" } -<<<<<<< HEAD + + main + + "419":{ "gameTitle": "Pottery", "gameUrl": "Pottery-Game", "thumbnailUrl": "Pottery.png" -======= ->>>>>>> c24ab932e1702441882a65b80d713ea232e18c46 + + + }