AISprite always alerts when you touch it
This commit is contained in:
@@ -857,7 +857,6 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this.sprite_canmove == false) {
|
if ( this.sprite_canmove == false) {
|
||||||
this.body.immovable = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( game.rnd.integerInRange(0, 100) < 95 )
|
if ( game.rnd.integerInRange(0, 100) < 95 )
|
||||||
@@ -929,6 +928,7 @@ 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.body.immovable = true;
|
||||||
this.awareness_change_enabled = true;
|
this.awareness_change_enabled = true;
|
||||||
this.lightmeter = 1.0;
|
this.lightmeter = 1.0;
|
||||||
this.sprite_can_see_lightmeter = 0.5;
|
this.sprite_can_see_lightmeter = 0.5;
|
||||||
@@ -1320,11 +1320,14 @@ 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 ( player.lightmeter >= x.sprite_can_see_lightmeter ) {
|
if ( this.physics.arcade.collide(x, player) ) {
|
||||||
|
x.setAwarenessEffect(STATE_ALERTED);
|
||||||
|
} else if ( player.lightmeter >= x.sprite_can_see_lightmeter ) {
|
||||||
x.setAwarenessEffect(STATE_ALERTED);
|
x.setAwarenessEffect(STATE_ALERTED);
|
||||||
} else {
|
} else {
|
||||||
x.setAwarenessEffect(STATE_CONCERNED);
|
x.setAwarenessEffect(STATE_CONCERNED);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
x.setAwarenessEffect(STATE_LOSTHIM);
|
x.setAwarenessEffect(STATE_LOSTHIM);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user