Subir archivos a "/"
Archivos iniciales
This commit is contained in:
+25
@@ -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
@@ -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>
|
||||
Reference in New Issue
Block a user