-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample7-whip-nowait.html
85 lines (73 loc) · 1.97 KB
/
sample7-whip-nowait.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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body>
<canvas id="app"></canvas>
<script type="text/javascript" src="tmlib.js"></script>
<script type="text/javascript" src="bulletml.js"></script>
<script type="text/javascript" srC="tmlib.bulletml.js"></script>
<script>
tm.main(function() {
app = tm.display.CanvasApp("#app");
app.fps = 60;
app.resize(320, 320).fitWindow();
app.replaceScene(MainScene());
app.run();
});
tm.define("MainScene", {
superClass: "tm.app.Scene",
init: function() {
this.superInit();
this.fromJSON({
children: {
enemy: {
type: "tm.display.CircleShape",
init: [50, 50],
x: 320 * 0.5, y: 320 * 0.1
},
player: {
type: "Player",
x: 320 * 0.5, y: 320 * 0.9
}
}
});
var params = {
target: this.player,
createNewBullet: function(runner) {
tm.bulletml.Bullet(runner).addChildTo(this);
}.bind(this)
};
bulletml.dsl();
var DANMAKU0 = new bulletml.Root({
top: action([
repeat(999, [
fire(speed(1.0), bullet()),
repeat(10, [
fire(direction(0, "sequence"), speed(0.1, "sequence"), bullet()),
]),
wait(120),
]),
]),
});
this.enemy.startDanmaku(DANMAKU0, params);
}
});
tm.define("Player", {
superClass: "tm.display.TriangleShape",
init: function() {
this.superInit(25, 25);
this.boundingType = "circle";
this.raduis = 2;
Player.SINGLETON = this;
},
update: function(app) {
var kb = app.keyboard;
this.position.add(kb.getKeyDirection().mul(4));
}
});
Player.SINGLETON = null;
</script>
</body>
</html>