-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathparticle.js
35 lines (34 loc) · 975 Bytes
/
particle.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
Particle = function(param){
var self = Entity(param);
self.value = param.value;
self.particleType = param.particleType;
self.type = "Particle";
self.map = param.map;
self.timer = 10;
self.direction = Math.random() * 2 - 1;
if(self.particleType === 'teleport'){
self.direction = 360 * Math.random();
}
if(self.particleType === 'kill'){
self.direction = 360 * Math.random();
}
if(self.particleType === 'heal'){
self.direction = 360 * Math.random();
}
self.getInitPack = function(){
var pack = {};
pack.id = self.id;
pack.x = self.x;
pack.y = self.y;
pack.map = self.map;
pack.value = self.value;
pack.timer = self.timer;
pack.particleType = self.particleType;
pack.direction = self.direction;
pack.type = self.type;
return pack;
}
Particle.list[self.id] = self;
return self;
}
Particle.list = [];