Skip to content

Commit 42f4f72

Browse files
Iniciando o dia 30
1 parent d801060 commit 42f4f72

File tree

6 files changed

+250
-0
lines changed

6 files changed

+250
-0
lines changed

30-WhackAMole/dirt.svg

Lines changed: 40 additions & 0 deletions
Loading

30-WhackAMole/finish.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Whack A Mole!</title>
6+
<link href='https://fonts.googleapis.com/css?family=Amatic+SC:400,700' rel='stylesheet' type='text/css'>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
11+
<h1>Whack-a-mole! <span class="score">0</span></h1>
12+
<button onClick="startGame()">Start!</button>
13+
14+
<div class="game">
15+
<div class="hole hole1">
16+
<div class="mole"></div>
17+
</div>
18+
<div class="hole hole2">
19+
<div class="mole"></div>
20+
</div>
21+
<div class="hole hole3">
22+
<div class="mole"></div>
23+
</div>
24+
<div class="hole hole4">
25+
<div class="mole"></div>
26+
</div>
27+
<div class="hole hole5">
28+
<div class="mole"></div>
29+
</div>
30+
<div class="hole hole6">
31+
<div class="mole"></div>
32+
</div>
33+
</div>
34+
35+
<script>
36+
const holes = document.querySelectorAll('.hole');
37+
const scoreBoard = document.querySelector('.score');
38+
const moles = document.querySelectorAll('.mole');
39+
40+
</script>
41+
</body>
42+
</html>

30-WhackAMole/mole.svg

Lines changed: 56 additions & 0 deletions
Loading

30-WhackAMole/start.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Whack A Mole!</title>
6+
<link href='https://fonts.googleapis.com/css?family=Amatic+SC:400,700' rel='stylesheet' type='text/css'>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
11+
<h1>Whack-a-mole! <span class="score">0</span></h1>
12+
<button onClick="startGame()">Start!</button>
13+
14+
<div class="game">
15+
<div class="hole hole1">
16+
<div class="mole"></div>
17+
</div>
18+
<div class="hole hole2">
19+
<div class="mole"></div>
20+
</div>
21+
<div class="hole hole3">
22+
<div class="mole"></div>
23+
</div>
24+
<div class="hole hole4">
25+
<div class="mole"></div>
26+
</div>
27+
<div class="hole hole5">
28+
<div class="mole"></div>
29+
</div>
30+
<div class="hole hole6">
31+
<div class="mole"></div>
32+
</div>
33+
</div>
34+
35+
<script>
36+
const holes = document.querySelectorAll('.hole');
37+
const scoreBoard = document.querySelector('.score');
38+
const moles = document.querySelectorAll('.mole');
39+
40+
</script>
41+
</body>
42+
</html>

30-WhackAMole/style.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
html {
2+
box-sizing: border-box;
3+
font-size: 10px;
4+
background: #ffc600;
5+
}
6+
7+
*, *:before, *:after {
8+
box-sizing: inherit;
9+
}
10+
11+
body {
12+
padding: 0;
13+
margin:0;
14+
font-family: 'Amatic SC', cursive;
15+
}
16+
17+
h1 {
18+
text-align: center;
19+
font-size: 10rem;
20+
line-height:1;
21+
margin-bottom: 0;
22+
}
23+
24+
.score {
25+
background:rgba(255,255,255,0.2);
26+
padding:0 3rem;
27+
line-height:1;
28+
border-radius:1rem;
29+
}
30+
31+
.game {
32+
width:600px;
33+
height:400px;
34+
display:flex;
35+
flex-wrap:wrap;
36+
margin:0 auto;
37+
}
38+
39+
.hole {
40+
flex: 1 0 33.33%;
41+
overflow: hidden;
42+
position: relative;
43+
}
44+
45+
.hole:after {
46+
display: block;
47+
background: url(dirt.svg) bottom center no-repeat;
48+
background-size:contain;
49+
content:'';
50+
width: 100%;
51+
height:70px;
52+
position: absolute;
53+
z-index: 2;
54+
bottom:-30px;
55+
}
56+
57+
.mole {
58+
background:url('mole.svg') bottom center no-repeat;
59+
background-size:60%;
60+
position: absolute;
61+
top: 100%;
62+
width: 100%;
63+
height: 100%;
64+
transition:all 0.4s;
65+
}
66+
67+
.hole.up .mole {
68+
top:0;
69+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ $ npm start
5252
* [27-ClickandDrag](https://herminiotorres.github.io/JavaScript30/27-ClickandDrag/finish.html)
5353
* [28-VideoSpeedController](https://herminiotorres.github.io/JavaScript30/28-VideoSpeedController/finish.html)
5454
* [29-CountdownTimer](https://herminiotorres.github.io/JavaScript30/29-CountdownTimer/finish.html)
55+
* [30-WhackAMole](https://herminiotorres.github.io/JavaScript30/30-WhackAMole/finish.html)

0 commit comments

Comments
 (0)