Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final #8

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<html >
<head>
<meta charset="UTF-8">
<title>SKELEBRO'S ROSHAM'BONE'</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Final</h1>
<ul>
<li><a href="examples/todo">ToDo<a/></li>
<li><a href="examples/audio-player">MPC Audio Player<a/></li>
<li><a href="examples/game-rps">Game RPS<a/></li>
</ul>
</body>
<center><h1>SKELEBRO'S ROSHAM'BONE'</h1>
<body>
<div id="flavor"></div>
<div class="img">
<img src="http://vignette2.wikia.nocookie.net/undertale/images/4/44/Sansanimated.gif/revision/latest?cb=20151130211747" alt="HTML5 Icon" width="105" height="150">
<img src="http://vignette2.wikia.nocookie.net/undertale/images/2/21/Papyrus1.PNG/revision/latest?cb=20151024191010" alt="HTML5 Icon" width="160" height="187">
</div>

<div id="computer"></div>
<div id="player"></div>

<div class="rectangle">
<div id="message"></div>
</div>

<div class="container group">
<div class="level">YOU LV 1</div>
<div id="win" class="scores">Wins:</div>
<div id="lose" class="scores">Lose:</div>
<div id="tie" class="scores">Tie:</div>
</div>

<div class = "buttons">
<button id="rock" class="button" onclick='playerChoice(0)'>BURNT PAN</button>
<button id="paper" class="button" onclick='playerChoice(1)'>TORN NOTEBOOK</button>
<button id="scissors" class="button" onclick='playerChoice(2)'>TOY KNIFE</button>
</div>

<h5> Copyright &copy; Toby Fox UNDERTALE</h5>

<!--Don't mind this, I just wanted to put it in for -->
<audio controls>
<source src="http://wada-designs.com/art258/Undertale%20OST%20-%20Nyeh%20Heh%20Heh!%20(Intro)%20+%20Bonetrousle%20Extended.mp3" type="audio/mpeg">
</audio>

<script src="js/index.js"></script>

</body>
</html>
64 changes: 64 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var userChoice = ["Burnt Pan", "Torn Notebook", "Toy Knife"];
var scores = [0, 0, 0,];

function playerChoice(id) {
var choice1 = userChoice[id];
var choice2 = randNum();

//massage for .rectangle
document.getElementById("message").innerHTML="*\ You chose the " + choice1 + ". Sans and Papyrus chose the " + choice2 + "\."

//message for flavor text
document.getElementById("flavor").innerHTML=compare(choice1, choice2);
displayScores();
}

function randNum() {
var randNum = [Math.floor(Math.random() * userChoice.length)]
var computerChoice = userChoice[randNum];
return computerChoice;
}

function compare(choice1, choice2) {
if (choice1 == choice2) {
scores[0]++;
scores[3]++;
return ("A DRAW?! PICK AGAIN\, HUMAN!");

} else if (choice1 == "Torn Notebook") {
if (choice2 == "Burnt Pan") {
scores[1]++;
scores[3]++;
return ("YOU WON!? I, THE GREAT PAPYRUS HAS BEEN DEFEATED!");
} else if (choice2 == "Toy Knife") {
scores[2]++;
scores[3]++;
return ("*\ geeettttttt dunked on!");}

} else if (choice1 == "Toy Knife") {
if (choice2 == "Burnt Pan") {
scores[2]++;
scores[3]++;
return ("YOU LOSE! YOU CAN NOT DEFEAT ME, HUMAN!");
} else if (choice2 == "Torn Notebook") {
scores[1]++;
scores[3]++;
return ("*\ wow, kid. you really WON me over.");}

} else if (choice1 == "Burnt Pan") {
if (choice2 == "Toy Knife") {
scores[1]++;
scores[3]++;
return ("*\ i guess you won. you really BURNT me good.");
} else {
scores[2]++;
scores[3]++;
return ("YOU LOST! NYEH HEH HEH!");}
}
}

function displayScores() {
document.getElementById("win").innerHTML = "Win: " + scores[1];
document.getElementById("lose").innerHTML = "Lose: " + scores[2];
document.getElementById("tie").innerHTML = "Tie: " + scores[0];
}
Loading