From 247d73a39f0a2f23f486e9214a82506b777f40f8 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Mon, 30 May 2016 16:02:52 +0100 Subject: [PATCH] Fix misalignment of grenade projectile sprite after recycling --- lib/game/weapons/grenade-launcher.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/game/weapons/grenade-launcher.js b/lib/game/weapons/grenade-launcher.js index a29aae0..f2299a0 100644 --- a/lib/game/weapons/grenade-launcher.js +++ b/lib/game/weapons/grenade-launcher.js @@ -87,7 +87,7 @@ EntityGrenade = tpf.Entity.extend({ }, reset: function( x, y, settings ) { - this.parent(x,y,settings); + this.parent( x-this.size.x/2, y-this.size.y/2, settings ); // center on spawn pos this.vel.x = -Math.sin(this.angle) * this.speed; this.vel.y = -Math.cos(this.angle) * this.speed; this.vel.z = 1.2; @@ -210,4 +210,4 @@ EntityGrenadeExplosion = tpf.Entity.extend({ ig.EntityPool.enableFor(EntityGrenadeExplosion); -}); \ No newline at end of file +});