-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.html
87 lines (54 loc) · 951 Bytes
/
test2.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<script src="Nandraki.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body{
margin:0px;
}
canvas {
border: solid 1px;
margin-left: 5px;
}
</style>
</head>
<body>
debug:
<br>
<script>
game.canvas_start("canvas",800,500)
Nandraki = game.context("canvas")
game.log_key;
game.log_down(logKey1);
x=0
y=0
function logKey1(e) {
if( e.code == "ArrowRight") {
x+=5
}
if( e.code == "ArrowLeft") {
x-=5
}
if( e.code == "ArrowUp" ) {
anim="pulo"
y-=5
if(pulo==1 ){
pulo=pulo-1
}
}
if( e.code == "ArrowDown") {
y+=5
}
}
function jogo(){
Nandraki.clearRect(0, 0,canvas.width,canvas.height);
Nandraki.beginPath();
Nandraki.stroke();
Nandraki.fillRect(x,y,50,50);
game.rest(jogo,Nandraki);
}
game.loop(jogo,Nandraki)
</script>
</body>
</html>