Update index.php
This commit is contained in:
65
index.php
65
index.php
@@ -1,62 +1,15 @@
|
||||
<?php
|
||||
// later kan hier PHP score / sessions
|
||||
<?php
|
||||
echo "hellotjes"
|
||||
?>
|
||||
echo "yo ";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="nl">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>loading...</title>
|
||||
<title>PHP test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Kijk naar de tab 👆</h1>
|
||||
|
||||
<script>
|
||||
// vaste dino positie
|
||||
const dinoPos = 5;
|
||||
|
||||
// wereld (komma = obstakel)
|
||||
let world = " , , , ";
|
||||
let jumping = false;
|
||||
let jumpFrames = 0;
|
||||
|
||||
function gameTick() {
|
||||
// wereld schuift naar links
|
||||
world = world.slice(1) + (Math.random() < 0.15 ? "," : " ");
|
||||
|
||||
let display = "";
|
||||
for (let i = 0; i < world.length; i++) {
|
||||
if (i === dinoPos) {
|
||||
// dino
|
||||
if (jumping && world[i] === ",") {
|
||||
display += ";"; // springt over obstakel
|
||||
} else {
|
||||
display += ".";
|
||||
}
|
||||
} else {
|
||||
display += world[i];
|
||||
}
|
||||
}
|
||||
|
||||
document.title = display;
|
||||
|
||||
// jump logica
|
||||
if (jumping) {
|
||||
jumpFrames--;
|
||||
if (jumpFrames <= 0) jumping = false;
|
||||
}
|
||||
}
|
||||
|
||||
// space = jump
|
||||
document.addEventListener("keydown", e => {
|
||||
if (e.code === "Space" && !jumping) {
|
||||
jumping = true;
|
||||
jumpFrames = 4;
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(gameTick, 180);
|
||||
</script>
|
||||
|
||||
<h1>dit komt uit html</h1>
|
||||
<p><?php echo "dit komt uit PHP"; ?></p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user