-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (22 loc) · 835 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (22 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var character = document.querySelector(".character");
var block = document.querySelector(".block");
function jump() {
if (character.classList != "animate") {
character.classList.add("animate");
}
setTimeout(function() {
character.classList.remove("animate");
}, 500);
}
var checkDead = setInterval(function() {
var characterTop =
parseInt(window.getComputedStyle(character).getPropertyValue("top"));
var blockLeft =
parseInt(window.getComputedStyle(block).getPropertyValue("left"));
if (blockLeft < 20 && blockLeft > 0 && characterTop >= 130) {
block.style.animation = "none";
block.style.display = "none";
alert("You are not the greatest man that ever lived :( refresh page to play again");
}
},
10);