Fix undefined error when reporting you to a guard
This commit is contained in:
@@ -737,6 +737,13 @@ var AISprite = function(game, x, y, key, frame) {
|
||||
}
|
||||
}
|
||||
|
||||
this.sawPlayer = function(game, player)
|
||||
{
|
||||
if ( isSet(this.lastSawPlayerAt) == true )
|
||||
this.lastSawPlayerAt.destroy();
|
||||
this.lastSawPlayerAt = new Phaser.Sprite(game, player.x, player.y, null);
|
||||
}
|
||||
|
||||
this.update = function()
|
||||
{
|
||||
if ( this.ready_to_update == false )
|
||||
|
||||
@@ -322,9 +322,7 @@ GameState.prototype.update = function()
|
||||
if ( x.collide_with_player == false )
|
||||
return;
|
||||
if ( x.canSeeSprite(player, false) == true ) {
|
||||
if ( isSet(x.lastSawPlayerAt) == true )
|
||||
x.lastSawPlayerAt.destroy();
|
||||
x.lastSawPlayerAt = new Phaser.Sprite(game, player.x, player.y, null);
|
||||
x.sawPlayer(game, player);
|
||||
if ( player.lightmeter >= x.sprite_can_see_lightmeter ) {
|
||||
x.setAwarenessEffect(STATE_ALERTED);
|
||||
} else {
|
||||
@@ -340,8 +338,10 @@ GameState.prototype.update = function()
|
||||
x.setAwarenessEffect(STATE_UNAWARE);
|
||||
}
|
||||
}
|
||||
if ( this.physics.arcade.overlap(x, player) == true )
|
||||
if ( this.physics.arcade.overlap(x, player) == true ) {
|
||||
x.sawPlayer(game, player);
|
||||
x.setAwarenessEffect(STATE_ALERTED);
|
||||
}
|
||||
if ( hasState(player, STATE_STEALING) == true &&
|
||||
x.sprite_has_treasure == true ) {
|
||||
var prevpos = player.body.position;
|
||||
|
||||
@@ -147,10 +147,6 @@ var moonlightSettings = {
|
||||
}
|
||||
],
|
||||
'images': [
|
||||
{
|
||||
'name': 'lightbox',
|
||||
'path': 'gfx/ui/lightbox.png'
|
||||
},
|
||||
{
|
||||
'name': 'hud',
|
||||
'path': 'gfx/ui/hud.png'
|
||||
|
||||
Reference in New Issue
Block a user