-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
35 lines (23 loc) · 678 Bytes
/
script.js
File metadata and controls
35 lines (23 loc) · 678 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
25
26
27
var character =
document.getElementById("character");
var block = document.getElementById("block");
function jump(){
if(character.classList !="animate"){
character.classList.add("animate");
}
setTimeout(function(){
character.classList.remove("animate");
},600);
}
var checkDead = setInterval(function(){
var characterTop =
parseInt(window.getComputedStyle(character).
getPropertyValue("top"));
var blockLeft =
parseInt(window.getComputedStyle(block).getPropertyValue("Left"));
if(blockLeft<40 && blockLeft>0 && characterTop>=110){
alert("You lose !");
block.style.animation= "none";
block.style.display = "none";
}
},10);