Close #44 : AI now stays where it's supposed to on initialization

This commit is contained in:
2014-07-06 20:52:47 -07:00
parent 1d689724d8
commit 5aaa025537
2 changed files with 42 additions and 33 deletions

View File

@@ -291,8 +291,7 @@
"sprite_facing":"left",
"sprite_group":"townsfolk-female",
"sprite_has_treasure":"true",
"sprite_name":"townsfolk-female-2",
"sprite_route":"BigTopRoute1"
"sprite_name":"townsfolk-female-2"
},
"type":"AI",
"visible":true,
@@ -310,13 +309,14 @@
"sprite_facing":"right",
"sprite_group":"townsfolk-male",
"sprite_has_treasure":"true",
"sprite_name":"townsfolk-male-3"
"sprite_name":"townsfolk-male-3",
"sprite_route":"BigTopRoute1"
},
"type":"AI",
"visible":true,
"width":0,
"x":128,
"y":320
"x":160,
"y":544
},
{
"gid":3544,
@@ -335,6 +335,25 @@
"width":0,
"x":160,
"y":832
},
{
"gid":3544,
"height":0,
"name":"BigTopGuard",
"properties":
{
"sprite_can_see_lightmeter":"0.15",
"sprite_canmove":"false",
"sprite_facing":"up",
"sprite_group":"townsfolk-guard",
"sprite_has_treasure":"true",
"sprite_name":"townsfolk-guard-2"
},
"type":"AI",
"visible":true,
"width":0,
"x":320,
"y":608
}],
"opacity":1,
"type":"objectgroup",
@@ -616,35 +635,23 @@
},
{
"x":0,
"y":128
},
{
"x":-64,
"y":192
},
{
"x":-64,
"y":320
},
{
"x":96,
"y":320
},
{
"x":96,
"y":128
},
{
"x":128,
"y":32
},
{
"x":128,
"y":-64
"x":64,
"y":96
},
{
"x":32,
"y":-64
"x":288,
"y":96
},
{
"x":352,
"y":32
},
{
"x":352,
"y":0
},
{
"x":0,
@@ -657,8 +664,8 @@
"type":"",
"visible":true,
"width":0,
"x":640,
"y":160
"x":160,
"y":512
}],
"opacity":1,
"type":"objectgroup",

View File

@@ -679,12 +679,14 @@ var AISprite = function(game, x, y, key, frame) {
this.action_wander();
}
}
this.update_new_values = function() {
if ( isSet(this.timer) )
this.timer.stop();
this.animations.destroy();
this.clearWordBubble();
this.origin.x = this.position.x;
this.origin.y = this.position.y;
this.state = STATE_UNAWARE;
this.view_distance = parseInt(this.view_distance);
this.state_changed_at = new Phaser.Point(this.x, this.y);
@@ -760,7 +762,7 @@ var AISprite = function(game, x, y, key, frame) {
this.view_distance = 32 * 5;
this.timer = null;
this.rotation_timer = null;
this.origin = new Phaser.Point(x, y);
this.origin = new Phaser.Point(this.x, this.y);
this.sprite_has_treasure = [true, false][game.rnd.integerInRange(0, 1)];
this.bubble_immediate = false;
this.bubble_text = null;