Look in random directions instead of always going clockwise
This commit is contained in:
@@ -999,16 +999,16 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.turnFaceRight = function() {
|
this.turnUnseenDirection = function() {
|
||||||
if ( hasState(this, STATE_FACE_DOWN) ) {
|
if ( this.seen_directions.length >= 4 )
|
||||||
setMovingState(this, STATE_FACE_LEFT);
|
this.seen_directions = [];
|
||||||
} else if ( hasState(this, STATE_FACE_LEFT) ) {
|
var directions = [STATE_FACE_DOWN, STATE_FACE_LEFT,
|
||||||
setMovingState(this, STATE_FACE_UP);
|
STATE_FACE_RIGHT, STATE_FACE_UP];
|
||||||
} else if ( hasState(this, STATE_FACE_UP) ) {
|
var newdirection = directions[game.rnd.integerInRange(0, 3)];
|
||||||
setMovingState(this, STATE_FACE_RIGHT);
|
while ( this.seen_directions.indexOf(newdirection) !== -1 ) {
|
||||||
} else if ( hasState(this, STATE_FACE_RIGHT) ) {
|
newdirection = directions[game.rnd.integerInRange(0, 3)];
|
||||||
setMovingState(this, STATE_FACE_DOWN);
|
|
||||||
}
|
}
|
||||||
|
setMovingState(this, newdirection);
|
||||||
this.animations.stop();
|
this.animations.stop();
|
||||||
this.animations.play("bipedrun" + spriteFacing(this));
|
this.animations.play("bipedrun" + spriteFacing(this));
|
||||||
this.animations.stop();
|
this.animations.stop();
|
||||||
@@ -1185,6 +1185,7 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.sprite_can_see_lightmeter = 0.3;
|
this.sprite_can_see_lightmeter = 0.3;
|
||||||
this.awareness_effect = null;
|
this.awareness_effect = null;
|
||||||
this.awareness_timer = null;
|
this.awareness_timer = null;
|
||||||
|
this.seen_directions = [];
|
||||||
this.sprite_awareness_duration = 60000;
|
this.sprite_awareness_duration = 60000;
|
||||||
this.sprite_canmove = 'true';
|
this.sprite_canmove = 'true';
|
||||||
this.collide_with_player = 'true';
|
this.collide_with_player = 'true';
|
||||||
|
|||||||
Reference in New Issue
Block a user