-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rwieberdink
committed
Jun 7, 2018
1 parent
0479ed2
commit 42f9e6c
Showing
20 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
body { | ||
background-color: black; | ||
background-position: center; | ||
background-size: cover; | ||
width: 800px; | ||
max-width: 100%; | ||
} | ||
|
||
.container { | ||
background-image: url(../images/gringotts.jpg); | ||
color: rgb(240, 229, 82); | ||
font-family: 'Arbutus Slab', serif; | ||
text-align: center; | ||
height: 100%; | ||
overflow: hidden; | ||
z-index: 0; | ||
float: center; | ||
} | ||
|
||
.jumbotron { | ||
background-image: url(../images/gringotts.jpg); | ||
color: rgb(240, 229, 82); | ||
font-family: 'Arbutus Slab', serif; | ||
} | ||
|
||
.flexbox { | ||
justify-content: center; | ||
} | ||
|
||
.col-md-4 { | ||
text-align: center; | ||
} | ||
|
||
.coinsFlexbox { | ||
display: flex; | ||
flex-direction: row; | ||
/*make flex-direction: row; for larger screens*/ | ||
justify-content: space-between; | ||
max-height: 200px; | ||
border-style: solid; | ||
border-color: rgb(240, 229, 82); | ||
border-width: 10px 10px; | ||
} | ||
.coinImg { | ||
size: auto; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,99 @@ | ||
$(document).ready(function(){ | ||
|
||
// Global Variables | ||
var wins = 0; | ||
var losses = 0; | ||
// correctNumber is the computer-generated number that the user must achieve. | ||
var correctNumber = Math.floor(Math.random() * 101+19); | ||
// total is the running sum of the user's coins | ||
var total = 0; | ||
|
||
var coins = $(".coinImg"); | ||
// The values of the coins are assigned a random number 1-12 | ||
var knut = Math.floor(Math.random() * 11 +1); | ||
var sickle = Math.floor(Math.random() * 11 +1); | ||
var galleon = Math.floor(Math.random() * 11 +1); | ||
var da = Math.floor(Math.random() * 11 +1); | ||
|
||
var coinAudio = src="../audio/coin-drop-4.mp3"; | ||
var gameAudio = new Audio("../audio/harrysWondrousWorld.mp3"); | ||
gameAudio.play(); | ||
|
||
|
||
// | ||
|
||
|
||
// Resetting the variables at the beginning of each round | ||
function reset() { | ||
// The computer generates a random number | ||
correctNumber = Math.floor(Math.random() * 101+19); | ||
// The player's running sum starts at 0 again | ||
total = 0; | ||
// The values of the coins are reassigned a random number 1-12 at the start of each round | ||
var knut = Math.floor(Math.random() * 11 +1); | ||
var sickle = Math.floor(Math.random() * 11 +1); | ||
var galleon = Math.floor(Math.random() * 11 +1); | ||
var da = Math.floor(Math.random() * 11 +1); | ||
// Running tallies for game variables | ||
$("#wins").html("Wins: " + wins); | ||
$("#losses").html("Losses: " + losses); | ||
$("#numberToGuess").html(correctNumber); | ||
$("#total").html(total); | ||
consoleLogGameVariables(); | ||
} | ||
|
||
function userWinLose() { | ||
// If use has won, display alert, increment wins by 1 | ||
if (total === correctNumber) { | ||
wins++; | ||
console.log("Mr. Potter has won."); | ||
reset(); | ||
alert("Thank you for your deposit, Mr. Potter."); | ||
} | ||
// If user has surpassed the correctNumber sum, display alert, increment losses | ||
else if (total > correctNumber) { | ||
losses++; | ||
console.log("Mr. Potter has lost."); | ||
reset(); | ||
alert("Count your coins again, Mr. Potter."); | ||
} | ||
} | ||
|
||
|
||
// ConsoleLog all the game data from each round | ||
function consoleLogGameVariables() { | ||
console.log("Wins: " + wins); | ||
console.log("Losses: " + losses); | ||
console.log("correctNumber: " + correctNumber + " userTotal: " + total); | ||
console.log("Knut: " + knut + " Sickle: " + sickle + " Galleon: " + galleon + " DA Coin: " + da); | ||
console.log("_________________________________"); | ||
} | ||
|
||
reset(); | ||
|
||
// Window listens for clicks on any of the coins | ||
$(".coinImg").on("click", function() { | ||
// The computer listens for which coin was clicked and finds its value | ||
var chosenCoin = $(this).attr("value"); | ||
// Cases of each coin being pressed and their corresponding values added to the user's running total | ||
if (chosenCoin == "knutValue") { | ||
total += knut; | ||
} else if (chosenCoin == "sickleValue") { | ||
total += sickle; | ||
} else if (chosenCoin == "galleonValue") { | ||
total += galleon; | ||
} else if (chosenCoin == "daValue") { | ||
total += da; | ||
} else { | ||
console.log("No coin selected."); | ||
} | ||
|
||
// Once a case has been chosen, update the user's running total | ||
$("#total").html(total); | ||
// Log all the variables for that round | ||
consoleLogGameVariables(); | ||
// Then log the user's win or loss | ||
userWinLose(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Gringott's Coin Collector</title> | ||
<!--Link to CSS stylesheet--> | ||
<link rel="stylesheet" type="text/css" href="assets/css/style.css"> | ||
<!--Link to Bootstrap--> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | ||
<!--Link to fonts used--> | ||
<link href="https://fonts.googleapis.com/css?family=Alegreya|Arbutus+Slab|Special+Elite" rel="stylesheet"> | ||
<!--Link to jQuery--> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | ||
<!--Link to Javascript file--> | ||
<script type="text/javascript" src="assets/javascript/game.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1>Welcome to Gringott's Wizard Bank!</h1> | ||
<h3>Press the coins to achieve the number displayed below.</h3> | ||
|
||
|
||
<div class="row flexbox"> | ||
<h1 id="numberToGuess">#</h1> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="coinsFlexbox"> | ||
<img class="coinImg" id="knut" value="knutValue" src="assets/images/knut.jpg" alt="Knut"> | ||
<img class="coinImg" id="sickle" value="sickleValue" src="assets/images/sickle.jpg" alt="Sickle"> | ||
<img class="coinImg" id="galleon" value="galleonValue" src="assets/images/galleon.jpg" alt="Galleon"> | ||
<img class="coinImg" id="da" value="daValue" src="assets/images/DA.jpeg" alt="Dumbledore's Army Coin"> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-4"> | ||
<h3 id="wins">Wins: </h3> | ||
</div> | ||
<div class="col-md-4"> | ||
<h2 id="total">Your Total: </h2> | ||
</div> | ||
<div class="col-md-4"> | ||
<h3 id="losses">Losses: </h3> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</body> | ||
|
||
|
||
</html> |