Subir archivos a "/"

Archivos iniciales
This commit is contained in:
2026-06-15 17:15:03 +02:00
commit 5ffa8a150b
3 changed files with 59 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
//La movemos cada 1000ms
setInterval(moverGallina, 500);
//InnerHeight y Width pa que no se salva de la pantalla.
function moverGallina() {
let top = Math.floor(Math.random() * (innerHeight - 100 + 1) + 100);
let right = Math.floor(Math.random() * (innerHeight - 100 + 1) + 100);
let bottom = Math.floor(Math.random() * innerWidth + 100);
let left = Math.floor(Math.random() * (innerWidth - 100 + 1) + 100);
//Lo de las comillas y el dolar dolor de wevos
document.getElementById("gallina").style.margin =
`${top}px ${right}px ${bottom}px ${left}px`;
}
function ganar(){
alert('¡Has pillado a la gallina!');
}
+18
View File
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="es-ES">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Juego Gallina</title>
<link href="/favicon.ico" type="image/x-icon" rel="icon" />
<link rel="stylesheet" href="/css/modern-normalize.css" />
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="gallina" onclick="ganar()">
<img src="images/pollo.png" alt="robot_chicken" />
</div>
</body>
<script src="gallina.js" type="text/javascript" defer></script>
</html>
+16
View File
@@ -0,0 +1,16 @@
body {
background-image: url("images/grass.jpg");
background-repeat: repeat;
display: flex;
justify-content: center;
}
#gallina {
/*Sin la absolute se lía*/
position: absolute;
width: 300px;
height: 300px;
transition-duration: 0.3s;
}