Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anasilveira9787 committed Oct 24, 2023
0 parents commit 11670ec
Show file tree
Hide file tree
Showing 13 changed files with 808 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
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?
34 changes: 34 additions & 0 deletions actions.js
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)



}

Binary file added covers/Captura de tela 2023-10-24 143223.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added covers/Captura de tela 2023-10-24 143236.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions createBoard.js
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

}



16 changes: 16 additions & 0 deletions index.html
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>
1 change: 1 addition & 0 deletions javascript.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions main.js
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()



18 changes: 18 additions & 0 deletions messages.js
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)
}

Loading

0 comments on commit 11670ec

Please sign in to comment.