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_facing":"left",
"sprite_group":"townsfolk-female", "sprite_group":"townsfolk-female",
"sprite_has_treasure":"true", "sprite_has_treasure":"true",
"sprite_name":"townsfolk-female-2", "sprite_name":"townsfolk-female-2"
"sprite_route":"BigTopRoute1"
}, },
"type":"AI", "type":"AI",
"visible":true, "visible":true,
@@ -310,13 +309,14 @@
"sprite_facing":"right", "sprite_facing":"right",
"sprite_group":"townsfolk-male", "sprite_group":"townsfolk-male",
"sprite_has_treasure":"true", "sprite_has_treasure":"true",
"sprite_name":"townsfolk-male-3" "sprite_name":"townsfolk-male-3",
"sprite_route":"BigTopRoute1"
}, },
"type":"AI", "type":"AI",
"visible":true, "visible":true,
"width":0, "width":0,
"x":128, "x":160,
"y":320 "y":544
}, },
{ {
"gid":3544, "gid":3544,
@@ -335,6 +335,25 @@
"width":0, "width":0,
"x":160, "x":160,
"y":832 "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, "opacity":1,
"type":"objectgroup", "type":"objectgroup",
@@ -616,35 +635,23 @@
}, },
{ {
"x":0, "x":0,
"y":128
},
{
"x":-64,
"y":192
},
{
"x":-64,
"y":320
},
{
"x":96,
"y":320
},
{
"x":96,
"y":128
},
{
"x":128,
"y":32 "y":32
}, },
{ {
"x":128, "x":64,
"y":-64 "y":96
}, },
{ {
"x":32, "x":288,
"y":-64 "y":96
},
{
"x":352,
"y":32
},
{
"x":352,
"y":0
}, },
{ {
"x":0, "x":0,
@@ -657,8 +664,8 @@
"type":"", "type":"",
"visible":true, "visible":true,
"width":0, "width":0,
"x":640, "x":160,
"y":160 "y":512
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",

View File

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