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()
|
this.update = function()
|
||||||
{
|
{
|
||||||
if ( this.ready_to_update == false )
|
if ( this.ready_to_update == false )
|
||||||
|
|||||||
@@ -322,9 +322,7 @@ GameState.prototype.update = function()
|
|||||||
if ( x.collide_with_player == false )
|
if ( x.collide_with_player == false )
|
||||||
return;
|
return;
|
||||||
if ( x.canSeeSprite(player, false) == true ) {
|
if ( x.canSeeSprite(player, false) == true ) {
|
||||||
if ( isSet(x.lastSawPlayerAt) == true )
|
x.sawPlayer(game, player);
|
||||||
x.lastSawPlayerAt.destroy();
|
|
||||||
x.lastSawPlayerAt = new Phaser.Sprite(game, player.x, player.y, null);
|
|
||||||
if ( player.lightmeter >= x.sprite_can_see_lightmeter ) {
|
if ( player.lightmeter >= x.sprite_can_see_lightmeter ) {
|
||||||
x.setAwarenessEffect(STATE_ALERTED);
|
x.setAwarenessEffect(STATE_ALERTED);
|
||||||
} else {
|
} else {
|
||||||
@@ -340,8 +338,10 @@ GameState.prototype.update = function()
|
|||||||
x.setAwarenessEffect(STATE_UNAWARE);
|
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);
|
x.setAwarenessEffect(STATE_ALERTED);
|
||||||
|
}
|
||||||
if ( hasState(player, STATE_STEALING) == true &&
|
if ( hasState(player, STATE_STEALING) == true &&
|
||||||
x.sprite_has_treasure == true ) {
|
x.sprite_has_treasure == true ) {
|
||||||
var prevpos = player.body.position;
|
var prevpos = player.body.position;
|
||||||
|
|||||||
@@ -147,10 +147,6 @@ var moonlightSettings = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
'images': [
|
'images': [
|
||||||
{
|
|
||||||
'name': 'lightbox',
|
|
||||||
'path': 'gfx/ui/lightbox.png'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'name': 'hud',
|
'name': 'hud',
|
||||||
'path': 'gfx/ui/hud.png'
|
'path': 'gfx/ui/hud.png'
|
||||||
|
|||||||
Reference in New Issue
Block a user