-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathelements.js
More file actions
83 lines (76 loc) · 1.7 KB
/
elements.js
File metadata and controls
83 lines (76 loc) · 1.7 KB
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
// Contains the classes for the different elements in the simulation
class Particle {
constructor(x, y, _id) {
this.x = x;
this.y = y;
this.color = [255, 255, 255];
this.id = _id;
}
}
class Sand extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.color = [255, 255, 0];
this.moveablePositions = [
[0, 1],
[1, 1],
[-1, 1],
];
}
}
class Water extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.color = [0, 50, 255];
this.moveablePositions = [
[0, 1],
// [1, 1],
// [-1, 1],
[1, 0],
[-1, 0],
];
}
}
class Wall extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.color = [100, 100, 100];
this.moveablePositions = [];
}
}
class AntiSand extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.color = [190, 190, 190];
this.moveablePositions = [
[0, -1],
[1, -1],
[-1, -1]
];
}
}
class AntiWater extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.color = [75, 75, 75];
this.moveablePositions = [
[0, -1],
[1, 0],
[-1, 0]
];
}
}
class Fire extends Particle {
constructor(x, y, _id) {
super(x, y, _id);
this.uses = 2; // Number of times element can evaporate water
this.color = [255, 0, 0];
this.moveablePositions = [
[0, 1],
[1, 1],
[-1, 1],
[1, 0],
[-1, 0]
];
}
}