diff --git a/Tech Memory Block/Images/1.jpg b/Tech Memory Block/Images/1.jpg new file mode 100644 index 00000000..3b8c6125 Binary files /dev/null and b/Tech Memory Block/Images/1.jpg differ diff --git a/Tech Memory Block/Images/10.jpg b/Tech Memory Block/Images/10.jpg new file mode 100644 index 00000000..d83196db Binary files /dev/null and b/Tech Memory Block/Images/10.jpg differ diff --git a/Tech Memory Block/Images/11.jpg b/Tech Memory Block/Images/11.jpg new file mode 100644 index 00000000..8e4248c4 Binary files /dev/null and b/Tech Memory Block/Images/11.jpg differ diff --git a/Tech Memory Block/Images/12.jpg b/Tech Memory Block/Images/12.jpg new file mode 100644 index 00000000..5f976658 Binary files /dev/null and b/Tech Memory Block/Images/12.jpg differ diff --git a/Tech Memory Block/Images/13.jpg b/Tech Memory Block/Images/13.jpg new file mode 100644 index 00000000..cdeee731 Binary files /dev/null and b/Tech Memory Block/Images/13.jpg differ diff --git a/Tech Memory Block/Images/14.jpg b/Tech Memory Block/Images/14.jpg new file mode 100644 index 00000000..640fe012 Binary files /dev/null and b/Tech Memory Block/Images/14.jpg differ diff --git a/Tech Memory Block/Images/15.jpg b/Tech Memory Block/Images/15.jpg new file mode 100644 index 00000000..859db35c Binary files /dev/null and b/Tech Memory Block/Images/15.jpg differ diff --git a/Tech Memory Block/Images/16.jpg b/Tech Memory Block/Images/16.jpg new file mode 100644 index 00000000..bd9ef289 Binary files /dev/null and b/Tech Memory Block/Images/16.jpg differ diff --git a/Tech Memory Block/Images/17.jpg b/Tech Memory Block/Images/17.jpg new file mode 100644 index 00000000..6846bdbe Binary files /dev/null and b/Tech Memory Block/Images/17.jpg differ diff --git a/Tech Memory Block/Images/18.jpg b/Tech Memory Block/Images/18.jpg new file mode 100644 index 00000000..907d2271 Binary files /dev/null and b/Tech Memory Block/Images/18.jpg differ diff --git a/Tech Memory Block/Images/2.jpg b/Tech Memory Block/Images/2.jpg new file mode 100644 index 00000000..ba202180 Binary files /dev/null and b/Tech Memory Block/Images/2.jpg differ diff --git a/Tech Memory Block/Images/3.jpg b/Tech Memory Block/Images/3.jpg new file mode 100644 index 00000000..024b7633 Binary files /dev/null and b/Tech Memory Block/Images/3.jpg differ diff --git a/Tech Memory Block/Images/4.jpg b/Tech Memory Block/Images/4.jpg new file mode 100644 index 00000000..db33d34d Binary files /dev/null and b/Tech Memory Block/Images/4.jpg differ diff --git a/Tech Memory Block/Images/5.jpg b/Tech Memory Block/Images/5.jpg new file mode 100644 index 00000000..aba41e80 Binary files /dev/null and b/Tech Memory Block/Images/5.jpg differ diff --git a/Tech Memory Block/Images/6.jpg b/Tech Memory Block/Images/6.jpg new file mode 100644 index 00000000..aa7a21ed Binary files /dev/null and b/Tech Memory Block/Images/6.jpg differ diff --git a/Tech Memory Block/Images/7.jpg b/Tech Memory Block/Images/7.jpg new file mode 100644 index 00000000..bab79f9c Binary files /dev/null and b/Tech Memory Block/Images/7.jpg differ diff --git a/Tech Memory Block/Images/8.jpg b/Tech Memory Block/Images/8.jpg new file mode 100644 index 00000000..6403fb63 Binary files /dev/null and b/Tech Memory Block/Images/8.jpg differ diff --git a/Tech Memory Block/Images/9.jpg b/Tech Memory Block/Images/9.jpg new file mode 100644 index 00000000..0bdaadde Binary files /dev/null and b/Tech Memory Block/Images/9.jpg differ diff --git a/Tech Memory Block/Images/copy/1.jpg b/Tech Memory Block/Images/copy/1.jpg new file mode 100644 index 00000000..3b8c6125 Binary files /dev/null and b/Tech Memory Block/Images/copy/1.jpg differ diff --git a/Tech Memory Block/Images/copy/10.jpg b/Tech Memory Block/Images/copy/10.jpg new file mode 100644 index 00000000..d83196db Binary files /dev/null and b/Tech Memory Block/Images/copy/10.jpg differ diff --git a/Tech Memory Block/Images/copy/11.jpg b/Tech Memory Block/Images/copy/11.jpg new file mode 100644 index 00000000..8e4248c4 Binary files /dev/null and b/Tech Memory Block/Images/copy/11.jpg differ diff --git a/Tech Memory Block/Images/copy/12.jpg b/Tech Memory Block/Images/copy/12.jpg new file mode 100644 index 00000000..5f976658 Binary files /dev/null and b/Tech Memory Block/Images/copy/12.jpg differ diff --git a/Tech Memory Block/Images/copy/13.jpg b/Tech Memory Block/Images/copy/13.jpg new file mode 100644 index 00000000..cdeee731 Binary files /dev/null and b/Tech Memory Block/Images/copy/13.jpg differ diff --git a/Tech Memory Block/Images/copy/14.jpg b/Tech Memory Block/Images/copy/14.jpg new file mode 100644 index 00000000..640fe012 Binary files /dev/null and b/Tech Memory Block/Images/copy/14.jpg differ diff --git a/Tech Memory Block/Images/copy/15.jpg b/Tech Memory Block/Images/copy/15.jpg new file mode 100644 index 00000000..859db35c Binary files /dev/null and b/Tech Memory Block/Images/copy/15.jpg differ diff --git a/Tech Memory Block/Images/copy/16.jpg b/Tech Memory Block/Images/copy/16.jpg new file mode 100644 index 00000000..bd9ef289 Binary files /dev/null and b/Tech Memory Block/Images/copy/16.jpg differ diff --git a/Tech Memory Block/Images/copy/17.jpg b/Tech Memory Block/Images/copy/17.jpg new file mode 100644 index 00000000..6846bdbe Binary files /dev/null and b/Tech Memory Block/Images/copy/17.jpg differ diff --git a/Tech Memory Block/Images/copy/18.jpg b/Tech Memory Block/Images/copy/18.jpg new file mode 100644 index 00000000..907d2271 Binary files /dev/null and b/Tech Memory Block/Images/copy/18.jpg differ diff --git a/Tech Memory Block/Images/copy/2.jpg b/Tech Memory Block/Images/copy/2.jpg new file mode 100644 index 00000000..ba202180 Binary files /dev/null and b/Tech Memory Block/Images/copy/2.jpg differ diff --git a/Tech Memory Block/Images/copy/3.jpg b/Tech Memory Block/Images/copy/3.jpg new file mode 100644 index 00000000..024b7633 Binary files /dev/null and b/Tech Memory Block/Images/copy/3.jpg differ diff --git a/Tech Memory Block/Images/copy/4.jpg b/Tech Memory Block/Images/copy/4.jpg new file mode 100644 index 00000000..db33d34d Binary files /dev/null and b/Tech Memory Block/Images/copy/4.jpg differ diff --git a/Tech Memory Block/Images/copy/5.jpg b/Tech Memory Block/Images/copy/5.jpg new file mode 100644 index 00000000..aba41e80 Binary files /dev/null and b/Tech Memory Block/Images/copy/5.jpg differ diff --git a/Tech Memory Block/Images/copy/6.jpg b/Tech Memory Block/Images/copy/6.jpg new file mode 100644 index 00000000..aa7a21ed Binary files /dev/null and b/Tech Memory Block/Images/copy/6.jpg differ diff --git a/Tech Memory Block/Images/copy/7.jpg b/Tech Memory Block/Images/copy/7.jpg new file mode 100644 index 00000000..bab79f9c Binary files /dev/null and b/Tech Memory Block/Images/copy/7.jpg differ diff --git a/Tech Memory Block/Images/copy/8.jpg b/Tech Memory Block/Images/copy/8.jpg new file mode 100644 index 00000000..6403fb63 Binary files /dev/null and b/Tech Memory Block/Images/copy/8.jpg differ diff --git a/Tech Memory Block/Images/copy/9.jpg b/Tech Memory Block/Images/copy/9.jpg new file mode 100644 index 00000000..0bdaadde Binary files /dev/null and b/Tech Memory Block/Images/copy/9.jpg differ diff --git a/Tech Memory Block/Images/org/1.jpg b/Tech Memory Block/Images/org/1.jpg new file mode 100644 index 00000000..3b8c6125 Binary files /dev/null and b/Tech Memory Block/Images/org/1.jpg differ diff --git a/Tech Memory Block/Images/org/10.jpg b/Tech Memory Block/Images/org/10.jpg new file mode 100644 index 00000000..d83196db Binary files /dev/null and b/Tech Memory Block/Images/org/10.jpg differ diff --git a/Tech Memory Block/Images/org/11.jpg b/Tech Memory Block/Images/org/11.jpg new file mode 100644 index 00000000..8e4248c4 Binary files /dev/null and b/Tech Memory Block/Images/org/11.jpg differ diff --git a/Tech Memory Block/Images/org/12.jpg b/Tech Memory Block/Images/org/12.jpg new file mode 100644 index 00000000..5f976658 Binary files /dev/null and b/Tech Memory Block/Images/org/12.jpg differ diff --git a/Tech Memory Block/Images/org/13.jpg b/Tech Memory Block/Images/org/13.jpg new file mode 100644 index 00000000..cdeee731 Binary files /dev/null and b/Tech Memory Block/Images/org/13.jpg differ diff --git a/Tech Memory Block/Images/org/14.jpg b/Tech Memory Block/Images/org/14.jpg new file mode 100644 index 00000000..640fe012 Binary files /dev/null and b/Tech Memory Block/Images/org/14.jpg differ diff --git a/Tech Memory Block/Images/org/15.jpg b/Tech Memory Block/Images/org/15.jpg new file mode 100644 index 00000000..859db35c Binary files /dev/null and b/Tech Memory Block/Images/org/15.jpg differ diff --git a/Tech Memory Block/Images/org/16.jpg b/Tech Memory Block/Images/org/16.jpg new file mode 100644 index 00000000..bd9ef289 Binary files /dev/null and b/Tech Memory Block/Images/org/16.jpg differ diff --git a/Tech Memory Block/Images/org/17.jpg b/Tech Memory Block/Images/org/17.jpg new file mode 100644 index 00000000..6846bdbe Binary files /dev/null and b/Tech Memory Block/Images/org/17.jpg differ diff --git a/Tech Memory Block/Images/org/18.jpg b/Tech Memory Block/Images/org/18.jpg new file mode 100644 index 00000000..907d2271 Binary files /dev/null and b/Tech Memory Block/Images/org/18.jpg differ diff --git a/Tech Memory Block/Images/org/2.jpg b/Tech Memory Block/Images/org/2.jpg new file mode 100644 index 00000000..ba202180 Binary files /dev/null and b/Tech Memory Block/Images/org/2.jpg differ diff --git a/Tech Memory Block/Images/org/3.jpg b/Tech Memory Block/Images/org/3.jpg new file mode 100644 index 00000000..024b7633 Binary files /dev/null and b/Tech Memory Block/Images/org/3.jpg differ diff --git a/Tech Memory Block/Images/org/4.jpg b/Tech Memory Block/Images/org/4.jpg new file mode 100644 index 00000000..db33d34d Binary files /dev/null and b/Tech Memory Block/Images/org/4.jpg differ diff --git a/Tech Memory Block/Images/org/5.jpg b/Tech Memory Block/Images/org/5.jpg new file mode 100644 index 00000000..aba41e80 Binary files /dev/null and b/Tech Memory Block/Images/org/5.jpg differ diff --git a/Tech Memory Block/Images/org/6.jpg b/Tech Memory Block/Images/org/6.jpg new file mode 100644 index 00000000..aa7a21ed Binary files /dev/null and b/Tech Memory Block/Images/org/6.jpg differ diff --git a/Tech Memory Block/Images/org/7.jpg b/Tech Memory Block/Images/org/7.jpg new file mode 100644 index 00000000..bab79f9c Binary files /dev/null and b/Tech Memory Block/Images/org/7.jpg differ diff --git a/Tech Memory Block/Images/org/8.jpg b/Tech Memory Block/Images/org/8.jpg new file mode 100644 index 00000000..6403fb63 Binary files /dev/null and b/Tech Memory Block/Images/org/8.jpg differ diff --git a/Tech Memory Block/Images/org/9.jpg b/Tech Memory Block/Images/org/9.jpg new file mode 100644 index 00000000..0bdaadde Binary files /dev/null and b/Tech Memory Block/Images/org/9.jpg differ diff --git a/Tech Memory Block/Pacifico-Regular.ttf b/Tech Memory Block/Pacifico-Regular.ttf new file mode 100644 index 00000000..b9265a2a Binary files /dev/null and b/Tech Memory Block/Pacifico-Regular.ttf differ diff --git a/Tech Memory Block/README.md b/Tech Memory Block/README.md new file mode 100644 index 00000000..583a9fa6 --- /dev/null +++ b/Tech Memory Block/README.md @@ -0,0 +1,43 @@ +# **Tech Memory Blocks** + +--- + +
+ +## **Description 📃** + +- Match pairs of tech icons from various technologies and devices by flipping blocks and remembering their positions to test and improve your memory skills. +

+ +## **functionalities 🎮** + +- Intro Screen — Introduction of the game +- Difficulty mode selection — Selection for a difficulty level for the game. The difference between each level will be explained in a later section. +- Gameplay area — This is where the user plays the actual game. +- Users will have limited number of attempts +- Displays the score of how many icons the user has guessed right +
+ +## **How to play? 🕹ī¸** +- Open the index.html file +- Select difficulty +- The tech memory blocks game consists of 36 blocks arranged in 6 x 6 fashion. +- The blocks have images on one side. The blocks are turned upside down with images facing down. One image is present on two blocks. +- You are supposed to match two blocks with the same image. If you have matched correctly then the blocks are removed else they are turned upside down again. + +
+ +## **Screenshots 📸** + +### Home + +![Home](home.png) + +### How to play + +![How to play](howtoplay.png) + +### Game + +![Game](game.png) + diff --git a/Tech Memory Block/Roboto-Thin.ttf b/Tech Memory Block/Roboto-Thin.ttf new file mode 100644 index 00000000..4e797cf7 Binary files /dev/null and b/Tech Memory Block/Roboto-Thin.ttf differ diff --git a/Tech Memory Block/game.png b/Tech Memory Block/game.png new file mode 100644 index 00000000..1576c4e2 Binary files /dev/null and b/Tech Memory Block/game.png differ diff --git a/Tech Memory Block/help.html b/Tech Memory Block/help.html new file mode 100644 index 00000000..9e8628ea --- /dev/null +++ b/Tech Memory Block/help.html @@ -0,0 +1,116 @@ + + + + +Memory Blocks Help + + + + + + + +

Tech Memory Blocks Game

+ + +

How to play:

+ +

DIRECTIONS-

+ + + + + \ No newline at end of file diff --git a/Tech Memory Block/help.png b/Tech Memory Block/help.png new file mode 100644 index 00000000..8db92e06 Binary files /dev/null and b/Tech Memory Block/help.png differ diff --git a/Tech Memory Block/home.css b/Tech Memory Block/home.css new file mode 100644 index 00000000..f0fbda65 --- /dev/null +++ b/Tech Memory Block/home.css @@ -0,0 +1,298 @@ +@font-face +{ + font-family : 'Pacifico'; + src : url("Pacifico-Regular.ttf"); +} + +@font-face +{ + font-family: 'Roboto'; + src : url("Roboto-Thin.ttf"); +} +html,body +{ + width : 100%; + height : 100%; + padding : 0px; + margin : 0px; + background-color: rgb(188, 194, 190); + +} + +.intro +{ + display: block; + position: fixed; + z-index : 1; + width : 100%; + height : 100%; + background-color : white; +} + +.leader +{ + display: inline-block; + width : 50%; + height : 91.8%; + background-color: white; + float : left; + overflow: scroll; + overflow-x: hidden; +} + +.options +{ + display: block; + margin : auto; + padding : 0px; + padding-top : 30px; +} + +.options li +{ + display: inline; + list-style-type: none; + padding : 50px; +} + +.options li img +{ + width : 30px; + height : 30px; +} + +.leaderboard +{ + display: block; + width : 100%; + font-family: 'Candara'; + color : black; + font-size : 40px; + font-weight: lighter; +} + +.score +{ + float : left; +} + +.score li +{ + font-family: 'Candara'; + font-size : 15px; + color : rgb(45, 45, 46); + display : block; + float : left; + margin-top : 10px; +} + +.intro h1 +{ +font-family: 'Pacifico'; +color : black; +display: block; +text-align: center; +font-size : 80px; +margin : auto; +position: relative; +top : 30%; +} + +.intro h1 sub +{ +font-size : 30px; +} + +.names +{ + display: block !important; + font-family: Roboto !important; + font-size : 20px !important; + text-align: center !important; + font-weight: lighter; +} +table[name='matrix'] +{ + display: none; + padding : 0px; + position: relative; + top : 3%; + +} + +table[name='matrix'] tr td{ + width : 80px; + height : 80px; + background-color: black; + border-radius: 5px; + transition: background-color 0.4s linear; +} + +.ele +{ + background-repeat: no-repeat; + background-size: 80px 80px; +} +.container +{ + display : block; + width : 100%; + height : 100%; + text-align : center; + margin : auto; +} + +.header +{ + display: block; + position: relative; + top : 0px; + left : 0px; + right : 0px; + padding : 0px; + margin : 0px; + width : 100%; + background-color: black; + text-align: center; +} + +.header-title +{ + display: block; + width : inherit; + font-family : 'Pacifico'; + color : white; + font-size : 23px; + padding : 0px; + padding-top: 5px; + padding-bottom: 5px; + margin : 0px; + margin-left: -10px; +} + +.header-title sub +{ + font-size : 15px; +} + +.header-title attempt +{ + float : right; +} + +.difficulty +{ + position: fixed; + display: none; + width : 100%; + height : 100%; + background-color : rgba(0,0,0,0.8); + z-index : 1; + text-align: center; +} + +.difficulty-levels +{ + display: block; + margin : auto; + margin-top : 15%; +} + +.difficulty-levels li +{ + list-style-type: none; + width : 40%; + background-color: white; + color : black; + border-radius: 5px; + padding : 20px 10px 20px 10px; + margin : auto; + font-family: Roboto; + font-weight: bold; + margin-top : 8px; +} + +.modal +{ + position: fixed; + display: none; + width : 100%; + height : 100%; + background-color : rgba(0,0,0,0.8); + z-index : 1; + text-align: center; +} + +.alert-message +{ + display: block; + width : 30%; + height : 30%; + background-color : white; + border-radius : 5px; + margin: auto; + margin-top: 15%; +} + +.alert-message h1 +{ + font-family: 'Calibri'; + font-size : 30px; + display: block; + text-align: center; + padding-top: 10%; +} + +.alert-message button +{ + width : 20%; + height : 20%; + background-color: cadetblue; + color : white; + font-family: 'Calibri'; + font-size : 13px; + border-width: 0px; +} +.message +{ + display : none; + width : 100%; + font-family: Arial; + color : black; + font-weight: lighter; + font-size : 25px; + margin : auto; + position: relative; + top : 30%; +} + +.message-button +{ + display: none; + width : 90px; + height : 45px; + border-width : 0px; + color : black; + background-color : white; + position: relative; + top : 35%; + margin : auto; + border-radius : 5px; +} + +@media only screen and (max-width : 1140px) +{ + .leader + { + width :35%; + } + +} + +@media only screen and (max-width : 1140px) +{ + .leader + { + width :100%; + } +} \ No newline at end of file diff --git a/Tech Memory Block/home.js b/Tech Memory Block/home.js new file mode 100644 index 00000000..d5d19cd1 --- /dev/null +++ b/Tech Memory Block/home.js @@ -0,0 +1,287 @@ +//arr[] contains the list of images +var arr=[]; + +//Stores the opened elements +var open_ele=[]; + +//Total number of matches found +var total=0; + +//Attempts for each difficulty level +var max_beginner = 30; +var max_intermediate = 27; +var max_expert = 25; + +//Attempts for User selected difficulty level +var attempts = max_beginner; + +//Stores the difficulty level that the user is currently playing. Initially initialized to empty +var mode=""; + +//Set to 1 if user fails a level else 0 +var fail=0; + +//Multiple blocks opened will be closed in the order of its opening +function changeImage(a) +{ + + //check if only one element is open + //if yes wait keep the element open expecting user to open another element + if(open_ele.length == 0) + { + a.style.backgroundColor="Transparent"; + a.style.backgroundImage="url('"+arr[Number(a.getAttribute("id"))]+"')"; + open_ele.push(a); + return; + } + + //if the present length of array is one add one more element and start checking for matching + if(open_ele.length == 1) + { + a.style.backgroundColor="Transparent"; + a.style.backgroundImage="url('"+arr[Number(a.getAttribute("id"))]+"')"; + open_ele.push(a); + + //if bg images of both images are the same + if(open_ele[0].style.backgroundImage.split("/")[2] == open_ele[1].style.backgroundImage.split("/")[2]) + { + window.setTimeout(function(){ + open_ele[0].style.backgroundColor="rgb(188, 194, 190)"; + open_ele[1].style.backgroundColor="rgb(188, 194, 190)"; + open_ele[0].style.visibility="hidden"; + open_ele[1].style.visibility="hidden"; + //Empty the array + open_ele.length=0; + + },2000); + //Incrementing the total number of matches found out of 8 + //Decides the end of game + total++; + var len = document.getElementsByClassName("score")[0].getElementsByTagName("li").length; + document.getElementsByClassName("score")[0].getElementsByTagName("li")[len-1].innerHTML="Blocks unlocked : " + String(total) + " / 18"; + + if(total == 18) //if all matches are found + { + showModal(); + eles = document.getElementsByClassName("score")[0].getElementsByTagName("li"); + eles[eles.length-2].innerHTML="Player 1 : " + mode +" Completed"; + document.getElementsByTagName("table")[0].style.display="none"; + document.getElementsByClassName("message")[0].style.display="block"; + document.getElementsByClassName("message")[0].innerHTML=":) Congrats. You unlocked all blocks!."; + document.getElementsByClassName("message-button")[0].style.display="block"; + return; + } + } + else + { + attempts--; //reduce the attempts + + //updating the attempts left in menu bar + document.getElementsByTagName("attempt")[0].innerHTML = "Attempts : " + attempts; + + if(attempts == 0) + { + showModal(); + fail=1; + eles = document.getElementsByClassName("score")[0].getElementsByTagName("li"); + eles[eles.length-2].innerHTML="Player 1 : " + mode +" Failed"; + document.getElementsByTagName("table")[0].style.display="none"; + document.getElementsByClassName("message")[0].style.display="block"; + document.getElementsByClassName("message")[0].innerHTML=":( Oops.....You ran out of attempts."; + document.getElementsByClassName("message-button")[0].style.display="block"; + open_ele.length=0; + return; + } + + + + //Give a 2 second delay for the user to see the picture and hide them + window.setTimeout(function(){ + open_ele[0].style.backgroundColor="black"; + open_ele[1].style.backgroundColor="black"; + open_ele[0].style.backgroundImage="none"; + open_ele[1].style.backgroundImage="none"; + open_ele.length=0; + },2000); + } + } + +} + +//This hides the intro screen +function hideIntro() +{ + window.setTimeout(function(){ + document.getElementsByClassName("intro")[0].style.display="none"; + selectDifficulty(); + setBackground(); + },5000); +} + +//Function for shuffling the array +function shuffle(array) { + var currentIndex = array.length, temporaryValue, randomIndex; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; + } + +//Sets the background image for each block which the user will open +//The array is shuffles using shuffle() and assigned to each block in order of the blocks +function setBackground() +{ + console.log("setb"); + arr.length=0; + for(var i=1;i<=18;i++) + { + arr.push("Images/org/"+String(i)+".jpg"); + arr.push("Images/copy/"+String(i)+".jpg"); + } + arr = shuffle(arr); + + //Set the attempts left on the menu bar as well + document.getElementsByTagName("attempt")[0].innerHTML = "Attempts : " + 0; + + //Hide the message and button elements + document.getElementsByClassName("message")[0].style.display="none"; + document.getElementsByClassName("message-button")[0].style.display="none"; + + //Show the table as before + document.getElementsByTagName("table")[0].style.display="inline-block"; + + //During the game we changed the visibility of td elements to hidden and removed its background color and set a bg image as well + //Revert all those actions and prepare the table for a fresh game + td = document.getElementsByClassName("ele"); + for(var i=0;iongoing"; + li_2.innerHTML="Blocks unlocked : " + String(total) + " / 18"; + + ul.appendChild(document.createElement("br")); + ul.appendChild(document.createElement("br")); + ul.appendChild(li_1); + ul.appendChild(document.createElement("br")); + ul.appendChild(li_2); + ul.appendChild(document.createElement("br")); + ul.appendChild(document.createElement("br")); + document.getElementsByTagName("attempt")[0].innerHTML = "Attempts : " + attempts; + document.getElementsByClassName("difficulty")[0].style.display="none"; //close modal and start the game + } + + //Restarts the game by reshuffling the array again. Done by calling the defined functions again. +function restartGame() +{ + fail=0; + document.getElementsByClassName("modal")[1].style.display="none"; + lis = document.getElementsByClassName("score")[0]; + lis.remove(); + + //create UL element, set class attribute to score and append it to leader element + ul = document.createElement("ul"); + ul.setAttribute("class","score"); + document.getElementsByClassName("leader")[0].appendChild(ul); + total=0; + selectDifficulty(); + setBackground(); +} + +function playAgain() +{ + total=0; + len = document.getElementsByClassName("score")[0].getElementsByTagName("li").length; + if(fail == 1) + { + if(mode == "Easy Level") + { + attempts=max_beginner; + total=0; + document.getElementsByClassName("score")[0].getElementsByTagName("li")[len-1].innerHTML="Blocks unlocked : " + String(total) + " / 18"; + } + + if(mode == "Intermediate Level") + { + attempts=max_intermediate; + total=0; + document.getElementsByClassName("score")[0].getElementsByTagName("li")[len-1].innerHTML="Blocks unlocked : " + String(total) + " / 18"; + } + + if(mode == "Hard Level") + { + attempts=max_expert; + total=0; + document.getElementsByClassName("score")[0].getElementsByTagName("li")[len-1].innerHTML="Blocks unlocked : " + String(total) + " / 18"; + } + document.getElementsByTagName("attempt")[0].innerHTML = "Attempts : " + attempts; + setBackground(); + } + else + { + selectDifficulty(); + setBackground(); + } +} + +function hideModal(a) +{ + document.getElementsByClassName("modal")[a].style.display="none"; +} + +function showModal() +{ + document.getElementsByClassName("modal")[0].style.display="block"; +} + +window.onresize = function() +{ + console.log(window.innerWidth); +} \ No newline at end of file diff --git a/Tech Memory Block/home.png b/Tech Memory Block/home.png new file mode 100644 index 00000000..9ffa7ec8 Binary files /dev/null and b/Tech Memory Block/home.png differ diff --git a/Tech Memory Block/howtoplay.png b/Tech Memory Block/howtoplay.png new file mode 100644 index 00000000..56fbb150 Binary files /dev/null and b/Tech Memory Block/howtoplay.png differ diff --git a/Tech Memory Block/index.html b/Tech Memory Block/index.html new file mode 100644 index 00000000..7d81e562 --- /dev/null +++ b/Tech Memory Block/index.html @@ -0,0 +1,131 @@ + + + + + Memory Block + + + + + + + +
+

TechMemoryBlocksThe game.

+
+ +
+ +
+ + + + + +
+ +
+

TechMemoryBlocksThe game. + Attempts : +

+ +
+ +
+
    +
  • +
  • +
+ +

Leaderboard

+
    + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ +
+ + \ No newline at end of file diff --git a/Tech Memory Block/manifest.json b/Tech Memory Block/manifest.json new file mode 100644 index 00000000..23d80b17 --- /dev/null +++ b/Tech Memory Block/manifest.json @@ -0,0 +1,9 @@ +{ + "name": "Tech Memory Blocks", + "short_name": "TechMemoryBlocks", + "description": "A fun game to play", + "start_url": "index.html", + "display": "standalone", + "background_color": "#f9f9f9", + "theme_color": "#006400" + } diff --git a/Tech Memory Block/restart.png b/Tech Memory Block/restart.png new file mode 100644 index 00000000..f98d7e60 Binary files /dev/null and b/Tech Memory Block/restart.png differ diff --git a/Tech Memory Block/stop.png b/Tech Memory Block/stop.png new file mode 100644 index 00000000..2b4a06aa Binary files /dev/null and b/Tech Memory Block/stop.png differ