-
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
1 parent
f12960a
commit 846bc7f
Showing
15 changed files
with
545 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
If you are stuck getting started or short of time, there is some starter code in starter.js. This will give you the initial state for the game. But remember: there are multiple ways you could code this game! | ||
|
||
As well as the code in starter.js you will likely need two functions: | ||
|
||
1. A function to check each guess. This function should decide if the guessed letter exists in the word. If it does, the letter should be displayed, if not, a snowman part should disappear. (Splitting the word into an array and using the includes method could be useful here 😉) | ||
|
||
2. A function to check if the game is over. If the game is over, this function should render the appropriate message, and, in the case of a win, reinstate all removed snowman parts and render the sunglasses. Again, the .includes method could be useful here! |
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 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 |
---|---|---|
@@ -0,0 +1,207 @@ | ||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
body { | ||
background-image: url('images/snowflake.png'); | ||
background-size: 15%; | ||
background-color: #d9f7f7; | ||
font-family: Verdana, Geneva, Tahoma, sans-serif; | ||
} | ||
|
||
.game-title { | ||
text-align: center; | ||
color: #2c3e50; | ||
font-size: 2em; | ||
margin: 20px 0; | ||
font-family: Verdana, Geneva, Tahoma, sans-serif; | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
#keyboard-container { | ||
display: flex; | ||
gap: 5px; | ||
max-width: 400px; | ||
flex-wrap: wrap; | ||
margin: 0 auto; | ||
justify-content: center; | ||
padding: 10px; | ||
} | ||
|
||
#guess-container { | ||
display: flex; | ||
justify-content: center; | ||
margin: 1em auto; | ||
padding: 10px; | ||
} | ||
|
||
.guess-box-container { | ||
background: white; | ||
padding: 15px 25px; | ||
border-radius: 8px; | ||
border: 1px solid #ddd; | ||
font-family: monospace; | ||
font-size: 24px; | ||
letter-spacing: 10px; /* This creates space between the dashes */ | ||
text-transform: uppercase; | ||
} | ||
|
||
button.letter { | ||
padding: 10px; | ||
border: none; | ||
width: 35px; | ||
height: 35px; | ||
border-radius: 4px; | ||
background-color: #c03a2b; | ||
color: white; | ||
font-size: 1.1em; | ||
text-transform: lowercase; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
button.letter:hover, | ||
button.letter:focus { | ||
background-color: #f0c419; | ||
color: black; | ||
} | ||
|
||
button.letter:active { | ||
background-color: #d9f7f7; | ||
color: black; | ||
} | ||
|
||
button.letter:disabled { | ||
background-color: #666; | ||
opacity: 0.5; | ||
cursor: not-allowed; | ||
} | ||
|
||
.guess-char { | ||
padding: 12px 0px; | ||
font-size: 1.5em; | ||
width: 40px; | ||
text-align: center; | ||
} | ||
|
||
.message { | ||
text-align: center; | ||
font-size: 1.2em; | ||
padding: 20px; | ||
background: white; | ||
border-radius: 8px; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
margin: 20px 0; | ||
} | ||
|
||
.message p { | ||
margin: 10px 0; | ||
} | ||
|
||
.lose-message { | ||
color: #ff6b6b; /* Light red color */ | ||
} | ||
|
||
.win-message { | ||
color: #2ecc71; /* Keep win message in green */ | ||
} | ||
|
||
.snowman-container { | ||
position: relative; | ||
width: 300px; | ||
margin: 2em auto 0 auto; | ||
height: 300px; | ||
} | ||
|
||
.snowman-part { | ||
max-width: 300px; | ||
position: absolute; | ||
} | ||
|
||
.body { | ||
bottom: 0; | ||
} | ||
|
||
.head { | ||
bottom: 145px; | ||
} | ||
|
||
.nose { | ||
bottom: 170px; | ||
} | ||
|
||
.scarf { | ||
bottom: 50px; | ||
} | ||
|
||
.hat { | ||
bottom: 250px; | ||
} | ||
|
||
.arm { | ||
bottom: 50px; | ||
} | ||
|
||
.sunglasses, | ||
.puddle { | ||
position: absolute; | ||
} | ||
|
||
.sunglasses { | ||
width: 120px; | ||
top: 58px; | ||
left: 90px; | ||
z-index: 2; | ||
visibility: hidden; | ||
} | ||
|
||
.puddle { | ||
width: 290px; | ||
top: 270px; | ||
left: 5px; | ||
z-index: -2; | ||
} | ||
|
||
.guess-word { | ||
background: #c2eceb; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
border: 2px solid #808080; | ||
display: flex; | ||
gap: 5px; | ||
align-items: center; | ||
} | ||
|
||
.guess-box { | ||
font-size: 1.5em; | ||
width: 30px; | ||
height: 40px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
text-transform: uppercase; | ||
} | ||
|
||
.new-game-btn { | ||
margin-left: 15px; | ||
padding: 8px 16px; | ||
background-color: #4caf50; | ||
color: white; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
font-size: 1em; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
.new-game-btn:hover { | ||
background-color: #45a049; | ||
} | ||
|
||
.new-game-btn:active { | ||
background-color: #3d8b40; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Melting Snowman</title> | ||
<link rel="stylesheet" href="index.css" /> | ||
</head> | ||
<body> | ||
<main> | ||
<h1 class="game-title">Melting Snowman Word Game</h1> | ||
<div class="snowman-container"> | ||
<img class="sunglasses" src="images/sunglasses.png" alt="sunglasses" /> | ||
<img | ||
class="snowman-part body" | ||
src="images/body.png" | ||
alt="snowman's body" | ||
/> | ||
<img | ||
class="snowman-part head" | ||
src="images/head.png" | ||
alt="snowman's head" | ||
/> | ||
<img | ||
class="snowman-part scarf" | ||
src="images/scarf.png" | ||
alt="snowman's scarf" | ||
/> | ||
<img | ||
class="snowman-part nose" | ||
src="images/nose.png" | ||
alt="snowman's nose" | ||
/> | ||
<img | ||
class="snowman-part arm" | ||
src="images/arm.png" | ||
alt="snowman's arm" | ||
/> | ||
<img | ||
class="snowman-part hat" | ||
src="images/hat.png" | ||
alt="snowman's hat" | ||
/> | ||
<img class="puddle" src="images/puddle.png" alt="puddle" /> | ||
</div> | ||
<div id="guess-container" aria-live="polite"></div> | ||
<div id="keyboard-container"></div> | ||
</main> | ||
<script type="module" src="starter.js"></script> | ||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.