-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2143 from chaanakyaaM/master
Bug Eliminator game extension added
- Loading branch information
Showing
14 changed files
with
389 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,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-BR"> | ||
|
||
<head> | ||
<title></title> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="estilo.css" /> | ||
<script src="jogo.js"></script> | ||
</head> | ||
|
||
<body onresize="ajustaTamanhoPalcoJogo()"> | ||
<div class="painel"> | ||
<div class="vidas"> | ||
<img id="v1" src="img/coracao_cheio.png" /> | ||
<img id="v2" src="img/coracao_cheio.png" /> | ||
<img id="v3" src="img/coracao_cheio.png" /> | ||
|
||
</div> | ||
|
||
<div class="cronometro">Start: <span id="cronometro"></span></div> | ||
|
||
</div> | ||
|
||
<script> | ||
document.getElementById('cronometro').innerHTML = tempo | ||
|
||
let criaMosquito = setInterval(function() { | ||
posicaoRandomica() | ||
|
||
}, criaMosquitoTempo) | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
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,64 @@ | ||
@charset "UTF-8"; | ||
|
||
|
||
html { | ||
cursor: url(img/mata_mosquito.png) 30 30, auto; | ||
} | ||
|
||
body { | ||
background-image: url(img/bg.jpg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
|
||
|
||
|
||
.mosquito1 { | ||
width: 50px; | ||
height: 50px; | ||
} | ||
|
||
.mosquito2 { | ||
width: 70px; | ||
height: 70px; | ||
} | ||
|
||
.mosquito3 { | ||
width: 90px; | ||
height: 90px; | ||
} | ||
|
||
|
||
|
||
|
||
.ladoA { | ||
transform: scaleX(1); | ||
} | ||
|
||
.ladoB { | ||
transform: scaleX(-1); | ||
} | ||
|
||
|
||
|
||
|
||
.painel { | ||
position: absolute; | ||
width: 190px; | ||
padding: 10px; | ||
left: 0px; | ||
bottom: 0px; | ||
border-top: solid 1px white; | ||
background-color: white; | ||
opacity: 0.7; | ||
} | ||
|
||
.vidas { | ||
float: left; | ||
} | ||
|
||
.cronometro { | ||
float: left; | ||
font-size: 20px; | ||
font-weight: bold; | ||
} |
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,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-BR"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<!-- CSS only --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="estilo.css" /> | ||
<title>Document</title> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="d-flex justify-content-center"> | ||
<img src="img/game_over.png" /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<div class="d-flex justify-content-center"> | ||
<button type="button" class="btn btn-dark btn-lg" onclick="window.location.href = 'index.html' ">Replay</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |
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,64 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="pt-BR"> | ||
|
||
<head> | ||
<title>Document</title> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<!-- CSS only --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="estilo.css" /> | ||
<script> | ||
function iniciarJogo() { | ||
let nivel = document.getElementById('nivel').value | ||
|
||
if (nivel === '') { | ||
alert('Selecione um nível valido.') | ||
return false | ||
} | ||
|
||
window.location.href = "app.html?" + nivel | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="d-flex justify-content-center"> | ||
<img src="img/game.png" /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<div class="d-flex justify-content-center"> | ||
<div class="mb-2"> | ||
<select class="form-control" id="nivel"> | ||
<option value="">---Select level---</option> | ||
<option value="normal">Beginner</option> | ||
<option value="dificil">Intermediate</option> | ||
<option value="extremo">Hard</option> | ||
<option value="insano">Extreme</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<div class="d-flex justify-content-center"> | ||
<button type="button" class="btn btn-danger btn-lg" onclick="iniciarJogo()">Play Game</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |
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,126 @@ | ||
let largura = 0 | ||
let altura = 0 | ||
let vidas = 1 | ||
let tempo = 30 | ||
|
||
let criaMosquitoTempo = 2000 | ||
|
||
let nivel = window.location.search | ||
nivel = nivel.replace('?', '') | ||
|
||
if (nivel === 'normal') { | ||
|
||
|
||
criaMosquitoTempo = 2000 | ||
|
||
} else if (nivel === 'dificil') { | ||
|
||
|
||
criaMosquitoTempo = 1500 | ||
|
||
} else if (nivel === 'extremo') { | ||
|
||
|
||
criaMosquitoTempo = 1000 | ||
|
||
} else if (nivel === 'insano') { | ||
|
||
|
||
criaMosquitoTempo = 750 | ||
|
||
} | ||
|
||
function ajustaTamanhoPalcoJogo() { | ||
altura = window.innerHeight | ||
largura = window.innerWidth | ||
|
||
console.log(largura, altura) | ||
} | ||
|
||
ajustaTamanhoPalcoJogo() | ||
|
||
let cronometro = setInterval(function() { | ||
|
||
tempo -= 1 | ||
|
||
if (tempo < 0) { | ||
clearInterval(cronometro) | ||
clearInterval(criaMosquito) | ||
window.location.href = 'vitoria.html' | ||
} else { | ||
document.getElementById('cronometro').innerHTML = tempo | ||
} | ||
|
||
}, 1000) | ||
|
||
function posicaoRandomica() { | ||
|
||
|
||
if (document.getElementById('mosquito')) { | ||
document.getElementById('mosquito').remove() | ||
|
||
|
||
if (vidas > 3) { | ||
|
||
window.location.href = 'fim_de_jogo.html' | ||
} else { | ||
document.getElementById('v' + vidas).src = "img/coracao_vazio.png" | ||
|
||
vidas++ | ||
|
||
} | ||
} | ||
|
||
|
||
let posicaoX = Math.floor(Math.random() * largura) - 90 | ||
let posicaoY = Math.floor(Math.random() * altura) - 90 | ||
|
||
|
||
posicaoX = posicaoX < 0 ? 0 : posicaoX | ||
posicaoY = posicaoY < 0 ? 0 : posicaoY | ||
|
||
console.log(posicaoX, posicaoY) | ||
|
||
let mosquito = document.createElement('img') | ||
mosquito.src = 'img/mosca.png' | ||
mosquito.className = tamanhoAleatorio() + ' ' + ladoAleatorio() //Espaço em branco na concatenação para não haver problema na chamada. | ||
mosquito.style.left = posicaoX + 'px' | ||
mosquito.style.top = posicaoY + 'px' | ||
mosquito.style.position = 'absolute' | ||
mosquito.id = 'mosquito' | ||
mosquito.onclick = function() { | ||
this.remove() | ||
} | ||
|
||
document.body.appendChild(mosquito) | ||
|
||
} | ||
|
||
|
||
function tamanhoAleatorio() { | ||
let classe = Math.floor(Math.random() * 3) | ||
|
||
switch (classe) { | ||
case 0: | ||
return 'mosquito1' | ||
|
||
case 1: | ||
return 'mosquito2' | ||
|
||
case 2: | ||
return 'mosquito3' | ||
} | ||
} | ||
|
||
function ladoAleatorio() { | ||
let classe = Math.floor(Math.random() * 3) | ||
|
||
switch (classe) { | ||
case 0: | ||
return 'ladoA' | ||
|
||
case 1: | ||
return 'ladoB' | ||
|
||
} | ||
} |
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,30 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Bug Eliminator", | ||
"version": "1.0", | ||
"description": "Bug Eliminator", | ||
"icons": { | ||
"48": "icon.png", | ||
"64": "icon.png", | ||
"128": "icon.png" | ||
}, | ||
"permissions": [ | ||
"storage" | ||
], | ||
"optional-permissions": [ | ||
"tabs" | ||
], | ||
"action": { | ||
"default_popup": "index.html" | ||
}, | ||
"web_accessible_resources": [ | ||
{ | ||
"resources": [ | ||
"index.html" | ||
], | ||
"matches": [ | ||
"<all_urls>" | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.