From eec9f13fc0442cc4be892f7b61de52009c1de339 Mon Sep 17 00:00:00 2001 From: Florrie Date: Fri, 24 Aug 2018 09:26:59 -0300 Subject: Spawn more particles from bigger moves --- index.js | 18 +++++++++--------- 1 file 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) } } -- cgit 1.3.0-6-gf8a5