From 5aaa025537240388b51c2150524d7166460c1386 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 6 Jul 2014 20:52:47 -0700 Subject: [PATCH] Close #44 : AI now stays where it's supposed to on initialization --- moonlight/gfx/map.json | 69 +++++++++++++++++++++------------------ moonlight/src/AISprite.js | 6 ++-- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/moonlight/gfx/map.json b/moonlight/gfx/map.json index 1807c02..986309c 100644 --- a/moonlight/gfx/map.json +++ b/moonlight/gfx/map.json @@ -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", diff --git a/moonlight/src/AISprite.js b/moonlight/src/AISprite.js index c2f89fa..3d07823 100644 --- a/moonlight/src/AISprite.js +++ b/moonlight/src/AISprite.js @@ -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;