From 8a81b105588b3f8273f14c64f84191745cd38522 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 14 Jun 2014 12:42:21 -0700 Subject: [PATCH] Adding static effect sprites from the map --- moonlight/js/moonlight-skulk.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 65e8295..b091fb8 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -577,6 +577,8 @@ var EffectSprite = function(game, x, y, key, frame, animation) { Phaser.Sprite.call(this, game, x, y, null); game.physics.arcade.enable(this); + this.collide_with_map = true; + this.collide_with_player = true; } 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); game.physics.arcade.enable(this); + this.collide_with_player = true; + this.collide_with_map = true; this.timer = null; this.bubble_text = null; this.enable_word_bubble = false; @@ -1032,13 +1036,19 @@ GameState.prototype.update = function() function _inner_collide(x) { - for ( var ln in this.map_collision_layers ) { - layer = this.map_collision_layers[ln]; - this.physics.arcade.collide(x, layer); + if ( x.collide_with_map == true ) { + for ( var ln in this.map_collision_layers ) { + layer = this.map_collision_layers[ln]; + this.physics.arcade.collide(x, layer); + } } + if ( x.collide_with_player == false ) + return; this.physics.arcade.collide(x, player); } + this.effectSprites.forEach(_inner_collide, this); + this.aiSprites.forEach(_inner_collide, this); this.updateShadowTexture(); if (game.time.fps !== 0) {