-
Notifications
You must be signed in to change notification settings - Fork 1
/
Arena.js
96 lines (95 loc) · 1.99 KB
/
Arena.js
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
88
89
90
91
92
93
94
95
96
function Ground() {
GameObj2.call(this, 0, 0, 0, 0, 0);
const _ = this;
_.scale = K.arenaSize;
_.mesh = Ground.mesh;
_.texture = loadTexture("assets/stoneFloor.png");
}
Ground.mesh = {
vertices: [
1, 0, 1,
0, 0, 1,
0, 0, 0,
1, 0, 0,
],
normals: [
0, 1, 0,
0, 1, 0,
0, 1, 0,
0, 1, 0,
],
texCoord: [
0, 0,
0, 32,
32, 32,
32, 0,
],
indices: [
0, 2, 1,
0, 3, 2,
]
};
Ground.prototype = Object.create(GameObj2.prototype);
function Wall() {
GameObj2.call(this, 0, 0, 0, 0, 0);
const _ = this;
_.scale = K.arenaSize;
_.scaleMatrix = scalem(K.arenaSize, K.wallHeight, K.arenaSize);
_.mesh = Wall.mesh;
_.texture = loadTexture("assets/Wall.png");
}
Wall.mesh = {
vertices: [
// north
0, 0, 0,
0, 1, 0,
1, 1, 0,
1, 0, 0,
// south
0, 0, 1,
0, 1, 1,
1, 1, 1,
1, 0, 1,
// west
0, 0, 0,
0, 1, 0,
0, 1, 1,
0, 0, 1,
// east
1, 0, 0,
1, 1, 0,
1, 1, 1,
1, 0, 1,
],
normals: [
// north
0, 0, 1,
0, 0, 1,
0, 0, 1,
0, 0, 1,
// south
0, 0, -1,
0, 0, -1,
0, 0, -1,
0, 0, -1,
1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
-1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0,
],
texCoord: [
0, 0, 0, 1, 32, 1, 32, 0,
0, 0, 0, 1, 32, 1, 32, 0,
0, 0, 0, 1, 32, 1, 32, 0,
0, 0, 0, 1, 32, 1, 32, 0,
],
indices: [
0, 2, 1,
0, 3, 2,
4 + 0, 4 + 1, 4 + 2,
4 + 0, 4 + 2, 4 + 3,
8 + 0, 8 + 1, 8 + 2,
8 + 0, 8 + 2, 8 + 3,
12 + 0, 12 + 2, 12 + 1,
12 + 0, 12 + 3, 12 + 2,
]
};
Wall.prototype = Object.create(GameObj2.prototype);