-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgameover.html
More file actions
43 lines (36 loc) · 1.19 KB
/
gameover.html
File metadata and controls
43 lines (36 loc) · 1.19 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html>
<head>
<title></title>
<script src="https://simplycodingcourses.com/files/simply.js"></script>
<script>
function start(){
sjs.open("target",1000,600);
// floor
var floor = new sjs.Image("Images/floor.png");
floor.bottom();
floor.setSize(1000, 35);
// GITHUB GLITCH: floor doesn't stay on bottom; use this
setTimeout(function(){
floor.bottom();
}, 1);
// lose text
var lose = new sjs.Text("Game Over!", 50, "#003300");
lose.center().offset(0, -150);
// restart button
var restartBtn = new sjs.Button("Try Again", function(){
window.location = "index.html";
});
restartBtn.center();
// score
var score = new sjs.Text("Score: " + localStorage.getItem("score"), 24, "blue");
score.offset(30, 30);
// reset data values
localStorage.setItem("score", 0);
localStorage.setItem("targetIncrement", 0);
} //end start
</script>
</head>
<body onload="start()">
<div id="target" style="margin:auto;background:lightblue;"></div>
</body>
</html>