diff --git a/Games/Dice-toss/README.md b/Games/Dice-toss/README.md new file mode 100644 index 0000000000..b94cac40f1 --- /dev/null +++ b/Games/Dice-toss/README.md @@ -0,0 +1 @@ +# DIceGame.github.io \ No newline at end of file diff --git a/Games/Dice-toss/dicee.html b/Games/Dice-toss/dicee.html new file mode 100644 index 0000000000..7af24270ae --- /dev/null +++ b/Games/Dice-toss/dicee.html @@ -0,0 +1,33 @@ + + + + + Dicee + + + + + + + +
+

Refresh Me

+ +
+

Player 1

+ +
+ +
+

Player 2

+ +
+ +
+ + + + + + + diff --git a/Games/Dice-toss/images/dice1.png b/Games/Dice-toss/images/dice1.png new file mode 100644 index 0000000000..543a9eec3d Binary files /dev/null and b/Games/Dice-toss/images/dice1.png differ diff --git a/Games/Dice-toss/images/dice2.png b/Games/Dice-toss/images/dice2.png new file mode 100644 index 0000000000..472bbacda9 Binary files /dev/null and b/Games/Dice-toss/images/dice2.png differ diff --git a/Games/Dice-toss/images/dice3.png b/Games/Dice-toss/images/dice3.png new file mode 100644 index 0000000000..5bb30aadc6 Binary files /dev/null and b/Games/Dice-toss/images/dice3.png differ diff --git a/Games/Dice-toss/images/dice4.png b/Games/Dice-toss/images/dice4.png new file mode 100644 index 0000000000..2c116a944d Binary files /dev/null and b/Games/Dice-toss/images/dice4.png differ diff --git a/Games/Dice-toss/images/dice5.png b/Games/Dice-toss/images/dice5.png new file mode 100644 index 0000000000..d566cd8552 Binary files /dev/null and b/Games/Dice-toss/images/dice5.png differ diff --git a/Games/Dice-toss/images/dice6.png b/Games/Dice-toss/images/dice6.png new file mode 100644 index 0000000000..8b98b3c374 Binary files /dev/null and b/Games/Dice-toss/images/dice6.png differ diff --git a/Games/Dice-toss/index.js b/Games/Dice-toss/index.js new file mode 100644 index 0000000000..b64920853a --- /dev/null +++ b/Games/Dice-toss/index.js @@ -0,0 +1,56 @@ +var randomnum1=Math.floor(Math.random()*6+1); + +var randomnum2=Math.floor(Math.random()*6+1); + +// For first dice(left) +if(randomnum1==1){ + document.getElementById("img1").setAttribute('src','images/dice1.png'); +} +else if(randomnum1==2){ + document.getElementById("img1").setAttribute('src','images/dice2.png'); +} +else if(randomnum1==3){ + document.getElementById("img1").setAttribute('src','images/dice3.png'); +} +else if(randomnum1==4){ + document.getElementById("img1").setAttribute('src','images/dice4.png'); +} +else if(randomnum1==5){ + document.getElementById("img1").setAttribute('src','images/dice5.png'); +} +else if(randomnum1==6){ + document.getElementById("img1").setAttribute('src','images/dice6.png'); +} + + + +// For second dice (right) +if(randomnum2==1){ + document.getElementById("img2").setAttribute('src','images/dice1.png'); +} +else if(randomnum2==2){ + document.getElementById("img2").setAttribute('src','images/dice2.png'); +} +else if(randomnum2==3){ + document.getElementById("img2").setAttribute('src','images/dice3.png'); +} +else if(randomnum2==4){ + document.getElementById("img2").setAttribute('src','images/dice4.png'); +} +else if(randomnum2==5){ + document.getElementById("img2").setAttribute('src','images/dice5.png'); +} +else if(randomnum2==6){ + document.getElementById("img2").setAttribute('src','images/dice6.png'); +} + +if(randomnum1>randomnum2){ +document.querySelector("h1").innerHTML="Player1 wins!!"; +} +else if(randomnum2>randomnum1){ + document.querySelector("h1").innerHTML="Player2 wins!!"; +} +else{ + document.querySelector("h1").innerHTML="It's a Draw!.....try again"; + +} \ No newline at end of file diff --git a/Games/Dice-toss/styles.css b/Games/Dice-toss/styles.css new file mode 100644 index 0000000000..c5ad74041c --- /dev/null +++ b/Games/Dice-toss/styles.css @@ -0,0 +1,41 @@ +.container { + width: 70%; + margin: auto; + text-align: center; +} + +.dice { + text-align: center; + display: inline-block; + +} + +body { + background-color: #393E46; +} + +h1 { + margin: 30px; + font-family: 'Lobster', cursive; + text-shadow: 5px 0 #232931; + font-size: 8rem; + color: #4ECCA3; +} + +p { + font-size: 2rem; + color: #4ECCA3; + font-family: 'Indie Flower', cursive; +} + +img { + width: 80%; +} + +footer { + margin-top: 5%; + color: #EEEEEE; + text-align: center; + font-family: 'Indie Flower', cursive; + +} diff --git a/Games/Membox/README.md b/Games/Membox/README.md new file mode 100644 index 0000000000..fbe92f827f --- /dev/null +++ b/Games/Membox/README.md @@ -0,0 +1,38 @@ +# **Membox** + +--- + +
+ +## **Description ๐Ÿ“ƒ** +- Game logic and basic description: MemBox is a memory based fun game with infinite levels each getting tougher ever level. +It has 4 boxes all different colors. +level 1: 1 box will glow for a sec and u need to click on it. +level 2 : now 2 boxes will glow and u need to remember the order and click it; +level 3 : now 3 boxes and so on. +Your duty is to remember the pattern of that glow and click it in the same order. +The game doesn't have end its just about when your memory power gives up. +**Test Your Memory Power** + +## **functionalities ๐ŸŽฎ** +- level 1: 1 box will glow for a sec and u need to click on it. +level 2 : now 2 boxes will glow and u need to remember the order and click it; +level 3 : now 3 boxes and so on. +
+ +## **How to play? ๐Ÿ•น๏ธ** +- Click any button to start +- Try to remember the sequence +- click that sequence in order and you will find yourself in next level +- Happy Playing๐Ÿ˜‰!! + +
+ +## **Screenshots ๐Ÿ“ธ** +![image](../../assets/images/Membox.png) +
+ +
+ +## **Working video ๐Ÿ“น** + diff --git a/Games/Membox/game.js b/Games/Membox/game.js new file mode 100644 index 0000000000..57bb6fc7d3 --- /dev/null +++ b/Games/Membox/game.js @@ -0,0 +1,94 @@ + +var buttonColours = ["red", "blue", "green", "yellow"]; + +var gamePattern = []; +var userClickedPattern = []; + +var started = false; +var level = 0; + +$(document).keypress(function() { + if (!started) { + $("#level-title").text("Level " + level); + nextSequence(); + started = true; + } +}); + +$(".btn").click(function() { + + var userChosenColour = $(this).attr("id"); + userClickedPattern.push(userChosenColour); + + playSound(userChosenColour); + animatePress(userChosenColour); + + checkAnswer(userClickedPattern.length-1); +}); + + +function checkAnswer(currentLevel) { + + if (gamePattern[currentLevel] === userClickedPattern[currentLevel]) { + + console.log("success"); + + if (userClickedPattern.length === gamePattern.length){ + setTimeout(function () { + nextSequence(); + }, 1000); + } + + } else { + + console.log("wrong"); + + playSound("wrong"); + + $("body").addClass("game-over"); + setTimeout(function () { + $("body").removeClass("game-over"); + }, 200); + + $("#level-title").text("Game Over, Press Any Key to Restart"); + + //2. Call startOver() if the user gets the sequence wrong. + startOver(); + } + +} + +function nextSequence() { + + userClickedPattern = []; + level++; + $("#level-title").text("Level " + level); + + var randomNumber = Math.floor(Math.random() * 4); + var randomChosenColour = buttonColours[randomNumber]; + gamePattern.push(randomChosenColour); + + $("#" + randomChosenColour).fadeIn(100).fadeOut(100).fadeIn(100); + playSound(randomChosenColour); +} + +function playSound(name) { + var audio = new Audio("sounds/" + name + ".mp3"); + audio.play(); +} + +function animatePress(currentColor) { + $("#" + currentColor).addClass("pressed"); + setTimeout(function () { + $("#" + currentColor).removeClass("pressed"); + }, 100); +} + +//1. Create a new function called startOver(). +function startOver() { + + //3. Inside this function, you'll need to reset the values of level, gamePattern and started variables. + level = 0; + gamePattern = []; + started = false; +} diff --git a/Games/Membox/index.html b/Games/Membox/index.html new file mode 100644 index 0000000000..6c0c27a175 --- /dev/null +++ b/Games/Membox/index.html @@ -0,0 +1,41 @@ + + + + + + Simon + + + + + +

Press A Key to Start

+
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + + + + diff --git a/Games/Membox/sounds/blue.mp3 b/Games/Membox/sounds/blue.mp3 new file mode 100644 index 0000000000..ae68cbae3d Binary files /dev/null and b/Games/Membox/sounds/blue.mp3 differ diff --git a/Games/Membox/sounds/green.mp3 b/Games/Membox/sounds/green.mp3 new file mode 100644 index 0000000000..896b9f968e Binary files /dev/null and b/Games/Membox/sounds/green.mp3 differ diff --git a/Games/Membox/sounds/red.mp3 b/Games/Membox/sounds/red.mp3 new file mode 100644 index 0000000000..e7738ae95e Binary files /dev/null and b/Games/Membox/sounds/red.mp3 differ diff --git a/Games/Membox/sounds/wrong.mp3 b/Games/Membox/sounds/wrong.mp3 new file mode 100644 index 0000000000..5ece8fd768 Binary files /dev/null and b/Games/Membox/sounds/wrong.mp3 differ diff --git a/Games/Membox/sounds/yellow.mp3 b/Games/Membox/sounds/yellow.mp3 new file mode 100644 index 0000000000..b360c086d3 Binary files /dev/null and b/Games/Membox/sounds/yellow.mp3 differ diff --git a/Games/Membox/styles.css b/Games/Membox/styles.css new file mode 100644 index 0000000000..6edc5390f4 --- /dev/null +++ b/Games/Membox/styles.css @@ -0,0 +1,53 @@ +body { + text-align: center; + background-color: #011F3F; +} + +#level-title { + font-family: 'Press Start 2P', cursive; + font-size: 3rem; + margin: 5%; + color: #FEF2BF; +} + +.container { + display: block; + width: 50%; + margin: auto; + +} + +.btn { + margin: 25px; + display: inline-block; + height: 200px; + width: 200px; + border: 10px solid black; + border-radius: 20%; +} + +.game-over { + background-color: red; + opacity: 0.8; +} + +.red { + background-color: red; +} + +.green { + background-color: green; +} + +.blue { + background-color: blue; +} + +.yellow { + background-color: yellow; +} + +.pressed { + box-shadow: 0 0 20px white; + background-color: grey; +} diff --git a/assets/images/Membox.png b/assets/images/Membox.png new file mode 100644 index 0000000000..ab7357d507 Binary files /dev/null and b/assets/images/Membox.png differ