Adding static effect sprites from the map

This commit is contained in:
2014-06-14 12:42:21 -07:00
parent 4c31cbe991
commit 8a81b10558

View File

@@ -577,6 +577,8 @@ var EffectSprite = function(game, x, y, key, frame, animation) {
Phaser.Sprite.call(this, game, x, y, null); Phaser.Sprite.call(this, game, x, y, null);
game.physics.arcade.enable(this); game.physics.arcade.enable(this);
this.collide_with_map = true;
this.collide_with_player = true;
} }
EffectSprite.prototype = Object.create(Phaser.Sprite.prototype); EffectSprite.prototype = Object.create(Phaser.Sprite.prototype);
@@ -728,6 +730,8 @@ var AISprite = function(game, x, y, key, frame) {
Phaser.Sprite.call(this, game, x, y, null); Phaser.Sprite.call(this, game, x, y, null);
game.physics.arcade.enable(this); game.physics.arcade.enable(this);
this.collide_with_player = true;
this.collide_with_map = true;
this.timer = null; this.timer = null;
this.bubble_text = null; this.bubble_text = null;
this.enable_word_bubble = false; this.enable_word_bubble = false;
@@ -1032,13 +1036,19 @@ GameState.prototype.update = function()
function _inner_collide(x) { function _inner_collide(x) {
if ( x.collide_with_map == true ) {
for ( var ln in this.map_collision_layers ) { for ( var ln in this.map_collision_layers ) {
layer = this.map_collision_layers[ln]; layer = this.map_collision_layers[ln];
this.physics.arcade.collide(x, layer); this.physics.arcade.collide(x, layer);
} }
}
if ( x.collide_with_player == false )
return;
this.physics.arcade.collide(x, player); this.physics.arcade.collide(x, player);
} }
this.effectSprites.forEach(_inner_collide, this);
this.aiSprites.forEach(_inner_collide, this); this.aiSprites.forEach(_inner_collide, this);
this.updateShadowTexture(); this.updateShadowTexture();
if (game.time.fps !== 0) { if (game.time.fps !== 0) {