diff options
author | jak1 <mike.wollmann@gmail.com> | 2021-08-02 00:12:08 +0200 |
---|---|---|
committer | jak1 <mike.wollmann@gmail.com> | 2021-08-02 00:12:08 +0200 |
commit | 6c6918bc386b9b085ebc070826294c755aff1f8a (patch) | |
tree | e27217ff431a64c69919efbd0b22e0af7f37024b /server/Entities/Bullet.js | |
parent | 74a41caff6e7274c6926f5ae26b4180c920bb3dc (diff) | |
download | thepixelworld-6c6918bc386b9b085ebc070826294c755aff1f8a.tar.gz thepixelworld-6c6918bc386b9b085ebc070826294c755aff1f8a.tar.bz2 thepixelworld-6c6918bc386b9b085ebc070826294c755aff1f8a.tar.xz thepixelworld-6c6918bc386b9b085ebc070826294c755aff1f8a.zip |
removed const directions (seems to bug a bit (or there is maybe a better way doing that *shrugs*)
fixed some formating
Diffstat (limited to 'server/Entities/Bullet.js')
-rw-r--r-- | server/Entities/Bullet.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/server/Entities/Bullet.js b/server/Entities/Bullet.js index cb5a1a4..5b93a45 100644 --- a/server/Entities/Bullet.js +++ b/server/Entities/Bullet.js @@ -6,9 +6,11 @@ var Bullet = function(parent, angle) { self.id = Math.random(); self.speedX = Math.cos(angle/180*Math.PI) *10; self.speedY = Math.sin(angle/180*Math.PI) *10; + self.dir = 0; self.parent = parent; self.timer = 0; self.toRemove = false; + var super_update = self.update; self.update = function(){ if (self.timer++ > 100) @@ -34,19 +36,21 @@ var Bullet = function(parent, angle) { self.getInitPack = function() { return { - id:self.id, - x:self.x, - y:self.y, - map:self.map, + id: self.id, + x: self.x, + y: self.y, + map: self.map, + dir: self.dir, }; } self.getUpdatePack = function() { return { - id:self.id, - x:self.x, - y:self.y, - map:self.map, + id: self.id, + x: self.x, + y: self.y, + map: self.map, + dir: self.dir, }; } |