-
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
0 parents
commit 11670ec
Showing
13 changed files
with
808 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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,34 @@ | ||
import { message, gotcha } from "./messages.js" | ||
|
||
const blankSquares = document.getElementsByClassName("square") | ||
|
||
export function handleClick(){ | ||
|
||
for (let index = 0; index < blankSquares.length; index++) { | ||
|
||
let element = blankSquares[index] | ||
|
||
element.addEventListener('click', function addClass(event){ | ||
event.target.classList.add('clicked') | ||
|
||
if(element.classList.contains('ghost')){ | ||
gotcha() | ||
return | ||
|
||
|
||
} else { | ||
message() | ||
} | ||
|
||
}) | ||
|
||
|
||
} | ||
|
||
|
||
console.log(blankSquares.length) | ||
|
||
|
||
|
||
} | ||
|
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,26 @@ | ||
|
||
|
||
export default function createBoard(squares){ | ||
|
||
let monster = "<div class='square ghost'><i class='ph-bold ph-skull'></i></div>" | ||
|
||
let randomPosition = Math.floor((Math.random() * squares) + 1); | ||
|
||
|
||
let newBoard = Array.apply(null, Array(squares)) | ||
|
||
for (let index = 0; index < newBoard.length; index++) { | ||
newBoard[index] = "<div class='square'></div>"; | ||
|
||
} | ||
|
||
newBoard.splice(randomPosition, 1, monster); | ||
|
||
let board = newBoard.join(" ") | ||
|
||
return board | ||
|
||
} | ||
|
||
|
||
|
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,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link href="https://fonts.googleapis.com/css2?family=Creepster&display=swap" rel="stylesheet"> | ||
<title>Cuidado onde clica!</title> | ||
</head> | ||
<body> | ||
<h1>Cuidado onde clica!</h1> | ||
<div id="app"></div> | ||
<script type="module" src="/main.js"></script> | ||
</body> | ||
</html> |
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,19 @@ | ||
import './style.css' | ||
import "@phosphor-icons/web/light"; | ||
import "@phosphor-icons/web/bold"; | ||
import {handleClick } from "./actions.js" | ||
|
||
import createBoard from './createBoard.js' | ||
|
||
|
||
|
||
document.querySelector('#app').innerHTML = ` | ||
${createBoard(30)} | ||
` | ||
|
||
handleClick() | ||
|
||
|
||
|
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,18 @@ | ||
const messages = ['Está salvo!', 'Você ainda vive', 'Teve sorte, hein?', 'Estou cada vez mais perto de você.','Já dise adeus para a família?','Ah, não foi dessa vez!'] | ||
|
||
|
||
|
||
export function message(){ | ||
|
||
let randomPosition = Math.floor(Math.random() * 6); | ||
|
||
return alert(messages[randomPosition]) | ||
} | ||
|
||
export function gotcha(){ | ||
|
||
let response = "Peguei você! HAHAHAHA *risada maléfica*" | ||
|
||
return alert(response) | ||
} | ||
|
Oops, something went wrong.