Big Boy update, wallpaper, sad escape, games, icon

This commit is contained in:
2024-08-06 23:12:45 +02:00
parent 80e5ed11b2
commit 6b8db20bc6
25 changed files with 513 additions and 15 deletions

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<script src="main.js"></script>
<title>Rock Paper Scisors</title>
</head>
<body>
<h1 id="opponent-score">0</h1>
<img id="opponent-choice">
<br>
<img id="your-choice">
<div id="choices"></div>
<h1 id="your-score">0</h1>
</body>
</html>

View File

@@ -0,0 +1,55 @@
let you;
let playerScore = 0;
let opponent;
let opponentScore = 0;
const choices = ["rock", "paper", "scissors"];
window.onload = () => {
for(let i=0;i<3;i++){
let choice = document.createElement("img");
choice.id = choices[i];
choice.src = `${choices[i]}.png`;
choice.addEventListener("click", selectChoice);
document.getElementById("choices").append(choice);
}
}
function selectChoice(){
you = this.id;
document.getElementById("your-choice").src = `${you}.png`;
opponent = choices[Math.floor(Math.random()*3)];
document.getElementById("opponent-choice").src = `${opponent}.png`;
if(you===opponent){
playerScore++;
opponentScore-=-1;
}else{
if(you==="rock"){
if(opponent==="paper"){
opponentScore++;
}
if(opponent==="scissors"){
playerScore++;
}
}else if(you === "paper"){
if(opponent==="rock"){
playerScore++;
}
if(opponent==="scissors"){
opponentScore++;
}
}else{
if(opponent==="rock"){
opponentScore++;
}
if(opponent==="paper"){
playerScore++;
}
}
}
document.getElementById("opponent-score").innerHTML = opponentScore;
document.getElementById("your-score").innerHTML = playerScore;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

View File

@@ -0,0 +1,33 @@
body{
font-family: Arial, Helvetica, sans-serif;
text-align: center;
}
img{
aspect-ratio: 1/1;
}
#opponent-choice{
width: 240px;
height: 240px;
/*background: #fcda45;*/
margin-top: 10px;
}
#your-choice{
width: 240px;
height: 240px;
/*background: #4fdc5e;*/
margin-top: 10px;
}
#choices{
width: 240px;
height: 80px;
/*background: #f4a478;*/
margin: 0 auto;
margin-top: 10px;
}
#choices img{
width: 80px;
height: 80px;
}