« get me outta code hell

Spawn more particles from bigger moves - csb-game - Pixelly spin-off of the Command Synergy Battle system used in Final Fantasy XIII
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-24 09:26:59 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-24 09:26:59 -0300
commiteec9f13fc0442cc4be892f7b61de52009c1de339 (patch)
tree5622e26e79349ff96774bdecb48d4879748b5bf2
parentddb2ff4cffa7ddffd6d9a8c4c4a16927d1be9316 (diff)
Spawn more particles from bigger moves
-rw-r--r--index.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/index.js b/index.js
index 1a32030..af58a89 100644
--- a/index.js
+++ b/index.js
@@ -1415,8 +1415,8 @@ class MagicProjectile extends Sprite {
       // this.target.yvel += 2 * yvel * this.target.knockbackMultiplier * actionKB
       // this.target.zvel += 2 * zvel * this.target.knockbackMultiplier * actionKB
 
-      for (let i = 0; i < 10 + Math.random() * 20; i++) {
-        this.battle.miscSprites.push(new SplashProjectile(this, this.action.color))
+      for (let i = 0; i < this.action.size * (20 + Math.random() * 10); i++) {
+        this.battle.miscSprites.push(new MagicSplashProjectile(this, this.action))
       }
 
       this.discarded = true
@@ -1431,18 +1431,18 @@ class MagicProjectile extends Sprite {
   }
 }
 
-class SplashProjectile extends Sprite {
-  constructor(position, color) {
+class MagicSplashProjectile extends Sprite {
+  constructor(position, action) {
     super()
 
     this.x = position.x
     this.y = position.y
     this.z = position.z
 
-    this.xvel = 120 * (Math.random() - 0.5)
-    this.yvel = 120 * (Math.random() - 0.25)
-    this.zvel = 120 * (Math.random() - 0.5)
-    this.color = color
+    this.xvel = 70 * action.size * (Math.random() - 0.5)
+    this.yvel = 40 * action.size * (Math.random() - 0.25)
+    this.zvel = 70 * action.size * (Math.random() - 0.5)
+    this.action = action
 
     this.canvas.width = 2
     this.canvas.height = 2
@@ -1465,7 +1465,7 @@ class SplashProjectile extends Sprite {
   draw() {
     const ctx = this.canvas.getContext('2d')
     ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
-    ctx.fillStyle = this.color
+    ctx.fillStyle = this.action.color
     ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
   }
 }