Working on effect bubbles (visual indicators for awareness state changes)
This commit is contained in:
@@ -696,6 +696,11 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
|
|
||||||
this.setAwarenessEffect = function(state) {
|
this.setAwarenessEffect = function(state) {
|
||||||
var animkey = "";
|
var animkey = "";
|
||||||
|
if ( this.awareness_effect !== null ) {
|
||||||
|
this.awareness_effect.alive = false;
|
||||||
|
this.awareness_effect.destroy();
|
||||||
|
this.awareness_effect = null;
|
||||||
|
}
|
||||||
if ( state == STATE_ALERTED ) {
|
if ( state == STATE_ALERTED ) {
|
||||||
animkey = "alerted";
|
animkey = "alerted";
|
||||||
} else if ( state == STATE_CONCERNED ) {
|
} else if ( state == STATE_CONCERNED ) {
|
||||||
@@ -1269,7 +1274,13 @@ 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 ) {
|
||||||
setAwarenessState(x, STATE_ALERTED);
|
if ( hasState(x, STATE_ALERTED) == false ) {
|
||||||
|
setAwarenessState(x, STATE_ALERTED);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( hasState(x, STATE_ALERTED) == true ) {
|
||||||
|
setAwarenessState(x, STATE_LOSTHIM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.physics.arcade.collide(x, player);
|
this.physics.arcade.collide(x, player);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user