TrashCan.prototype = Object.create(Phaser.Sprite.prototype); TrashCan.prototype.constructor = TrashCan; function TrashCan() { Phaser.Sprite.call(this, game, TrashCan.POSITION_X, TrashCan.POSITION_Y, 'trash_can'); this.anchor.set(0.5, 1); this.scale.set(1); this.smoothed = false; this.inputEnabled = false; game.add.existing(this); } TrashCan.prototype.isOver = function(x, y) { var halfWidth = this.width / 2; var halfHeight = this.height; if(x < this.x - halfWidth) return false; else if(this.x + halfWidth < x) return false; else if(y < this.y - this.height) return false; else if(this.y < y) return false; return true; } TrashCan.prototype.animateAngry = function(meat) { var tween = game.add.tween(this.scale); tween.to({x:1.2, y:1.2}, 500, Phaser.Easing.Elastic.Out, true, 0); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0); tween.onComplete.add(this.resetScale, this); tween.start(); } TrashCan.prototype.resetScale = function() { this.scale.set(1); } TrashCan.POSITION_X = God.POSITION_X - 200; TrashCan.POSITION_Y = God.POSITION_Y + 50;