-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlevels.moon
More file actions
56 lines (41 loc) · 915 Bytes
/
levels.moon
File metadata and controls
56 lines (41 loc) · 915 Bytes
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
export *
width = 16
tid = (row, col) -> row * width + col
class Level1 extends World
energy_needed: 10
enemy_types: { Green }
num_spawns: 3
bg_tiles: {
{ 100, tid 0, 1 }
{ 20, tid 1, 1 }
{ 5, tid 2, 1 }
{ 5, tid 3, 1 }
{ 1, tid 4, 1 }
{ 50, tid 5, 1 }
}
class Level2 extends World
energy_needed: 20
enemy_types: { Green, Blue }
num_spawns: 4
bg_tiles: {
{ 100, tid 0, 0 }
{ 20, tid 1, 0 }
{ 3, tid 2, 0 }
}
class Level3 extends World
energy_needed: 30
enemy_types: { Green, Blue, Red }
num_spawns: 5
bg_tiles: {
{ 100, tid 0, 2 }
{ 20, tid 1, 2 }
{ 3, tid 2, 2 }
}
class Endless extends World
energy_needed: 40
enemy_types: { Green, Blue, Red, Orange }
num_spawns: 7
new: (...) =>
levels = { Level1, Level2, Level3 }
@bg_tiles = levels[math.random #levels].bg_tiles
super ...