-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·57 lines (50 loc) · 1.16 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo game</title>
<style>canvas{position:absolute;top:0px;bottom: 0px;left:0px;right:0px;margin:auto;border:1px solid black;}</style>
</head>
<body>
<script src="engine.js"></script>
<script src="sprite.js"></script>
<script src="bird.js"></script>
<script src="fundo.js"></script>
<script>
GAME.main( () => {
atualiza( () => {
fundo.atualiza()
bird.atualiza()
})
desenha( () => {
fundo.desenha()
bird.desenha()
})
})
GAME.cursor("mousedown", e => {
status("jogar", function(){
this.jogando()
})
status("jogando", function(){
bird.pula()
})
status("perdeu", function(){
this.jogar()
})
})
GAME.key("keyup", e => {
if(e.code == "Space")
{
status("jogar", function(){
this.jogando()
})
status("jogando", function(){
bird.pula()
})
}
})
</script>
</body>
</html>