Skip to content

Commit 313d660

Browse files
authored
add
My jooj respect ok
1 parent 180e68e commit 313d660

11 files changed

+218
-0
lines changed

Exodarknes/estilo.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*configurar a cor de funda da tabela, altura...*/
2+
#table{
3+
float:left;
4+
width: auto;
5+
height: 550px;
6+
background: #FFF;
7+
margin-right: 300px;
8+
}
9+
/*tamanho da fonte dos segundos que ficam no cronometro*/
10+
.cro{
11+
font-size: 30px;
12+
color: blue;
13+
}
14+
/*para fazer aparecer o cenario, definir um tamanho para ele..*/
15+
.cenario{
16+
float: left;
17+
width: 600px;
18+
height:550px;
19+
background: url('img/cenario.png');
20+
}
21+
/*para aparecer o conometro e alinhar o tempo*/
22+
.cronometroIMG{
23+
background: url('img/cronometro.png');
24+
text-align: center;
25+
}
26+
/*pra definir um tamanho pra contagem de baloes..*/
27+
.fontNBaloes{
28+
font-size: 40px;
29+
}

Exodarknes/game.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE HTML>
2+
<html lang="pt-br">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
6+
<title>Estourando balões</title>
7+
<link rel="stylesheet" type="text/css" href="estilo.css">
8+
9+
<script src="game.js"></script>
10+
11+
</head>
12+
13+
<body onload="iniciarGame()">
14+
<div id="table">
15+
<table class="form-group">
16+
<tr>
17+
<td><img src="img/balao_azul_grande.png" /></td>
18+
<td><span id="baloesVivos" class="fontNBaloes"></span></td>
19+
</tr>
20+
</table>
21+
<br>
22+
<table>
23+
<tr>
24+
<td><img src="img/balao_azul_grande_estourado.png" /></td>
25+
<!--tavivo ou ta morto?? akskfsk (schrodinger)-->
26+
<td><span id="baloesMortos" class="fontNBaloes"></span></td>
27+
</tr>
28+
</table>
29+
<br>
30+
31+
<table style="width: 140px; height: 132px; ">
32+
<tr>
33+
<td class="cronometroIMG">
34+
<span id="c" class="cro"></span>
35+
</td>
36+
</tr>
37+
</table>
38+
39+
<table style=" height: 132px; ">
40+
<tr>
41+
<td>
42+
<button type="button" class="btn btn-lg btn-danger" onclick="reiniciar()" >Reiniciar</button>
43+
</td>
44+
</tr>
45+
</table>
46+
47+
</div>
48+
49+
50+
51+
<div id="cena" class="cenario"> </div>
52+
</body>
53+
54+
</html>

Exodarknes/game.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
var temp = null;
2+
function iniciarGame(){
3+
var url = window.location.search;
4+
var nivel = url.replace('?', "");
5+
var tempo = null;
6+
7+
if(nivel == 1 ){
8+
tempo = 120;
9+
}
10+
if(nivel == 2 ){
11+
tempo = 60;
12+
}
13+
if(nivel == 3 ){
14+
tempo = 30;
15+
}
16+
document.getElementById('c').innerHTML = tempo;
17+
var qBalao = 80;
18+
criaBalao(qBalao);
19+
20+
document.getElementById('baloesVivos').innerHTML = qBalao;
21+
document.getElementById('baloesMortos').innerHTML = 0;
22+
23+
contagem(tempo);
24+
}
25+
26+
function contagem(segundos){
27+
segundos -= 1;
28+
if(segundos == -1){
29+
clearTimeout(temp);
30+
defeat();
31+
return false;
32+
}
33+
document.getElementById('c').innerHTML = segundos;
34+
temp = setTimeout("contagem("+segundos+")", 1000);
35+
}
36+
37+
function criaBalao(qBalao){
38+
for(var x = 0; x < qBalao;x++){
39+
var balao = document.createElement("img");
40+
balao.src = 'img/balao_azul_pequeno.png';
41+
balao.style.margin = '12px';
42+
balao.id = 'b'+x;
43+
balao.onclick = function(){ estourar(this); };
44+
document.getElementById('cena').appendChild(balao);
45+
}
46+
}
47+
48+
// tela de derrota
49+
function defeat(){
50+
remove_eventos_baloes();
51+
alert('fim the game');
52+
}
53+
54+
//substituir a imagem de balão normal..
55+
function estourar(e){
56+
var balaoID = e.id;
57+
document.getElementById(balaoID).setAttribute("onclick", "");
58+
document.getElementById(balaoID).src = 'img/balao_azul_pequeno_estourado.png';
59+
estourado = balaoID;
60+
pontuacao(-1);
61+
62+
}
63+
64+
65+
function pontuacao(acao){
66+
var baloesINT = document.getElementById('baloesVivos').innerHTML;
67+
var baloesOFF = document.getElementById('baloesMortos').innerHTML;
68+
baloesINT = parseInt(baloesINT);
69+
baloesOFF = parseInt(baloesOFF);
70+
baloesINT += acao;
71+
baloesOFF -= acao;
72+
73+
document.getElementById('baloesVivos').innerHTML = baloesINT;
74+
document.getElementById('baloesMortos').innerHTML = baloesOFF;
75+
76+
situacao(baloesINT);
77+
}
78+
79+
function situacao(baloesINT){
80+
if(baloesINT == 0){
81+
var t = document.getElementById('c').innerHTML;
82+
var tB = document.getElementById('baloesMortos').innerHTML;
83+
alert('PÁRABENS VOCê CONSEGUIU ESTOURAR OS BALÕES!!!!!!! TEMPO QUE RESRTAVA: '+t+'s. Com um '
84+
+'total de baloes estourados de: '+tB);
85+
pararJogo();
86+
}
87+
}
88+
89+
function pararJogo(){
90+
clearTimeout(temp);
91+
document.getElementById('baloesVivos').innerHTML = 'FIM';
92+
document.getElementById('baloesMortos').innerHTML = 'FIM';
93+
94+
}
95+
function remove_eventos_baloes() {
96+
var i = 1;
97+
while(document.getElementById('b'+i)) {
98+
document.getElementById('b'+i).onclick = '';
99+
i++;
100+
}
101+
}
102+
103+
function reiniciar(){
104+
window.location.href = 'index.html?';
105+
}

Exodarknes/img/balao_azul_grande.png

58.5 KB
Loading
71.6 KB
Loading

Exodarknes/img/balao_azul_pequeno.png

52.3 KB
Loading
58.5 KB
Loading

Exodarknes/img/cenario.png

737 KB
Loading

Exodarknes/img/cronometro.png

75.6 KB
Loading

Exodarknes/img/iniciar.png

90.5 KB
Loading

0 commit comments

Comments
 (0)