From: MegaBrutal Date: Fri, 29 Dec 2017 22:55:00 +0000 (+0100) Subject: Shake monsters when damaged X-Git-Url: http://git.megabrutal.com/?p=ld40.git;a=commitdiff_plain;h=3657126690124fe9be25d75600ba29b0fd50db63;ds=sidebyside Shake monsters when damaged Monsters should give some feedback when they are damaged to let the player know that shooting them has effect. modified: ld40.js --- diff --git a/ld40.js b/ld40.js index e981a9e..53e41f8 100644 --- a/ld40.js +++ b/ld40.js @@ -161,6 +161,11 @@ game.physics.arcade.enable(this); } + damage(amount) { + super.damage(amount); + if (this.alive) { game.add.tween(this).to({ x: this.x + (Math.random() - 0.5) * 10 }, 10, Phaser.Easing.Sinusoidal.InOut, true, 0, 8, true); } + } + kill() { super.kill(); player.loveUp();