diff options
Diffstat (limited to 'src/com')
| -rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | 4 | ||||
| -rw-r--r-- | src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/AutomaticViewpoint.java | 11 |
2 files changed, 8 insertions, 7 deletions
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 342b65f..43cf626 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |||
| @@ -188,8 +188,8 @@ public class SpecialEvent { | |||
| 188 | /** | 188 | /** |
| 189 | * Pans the viewpoint the the specified tile location | 189 | * Pans the viewpoint the the specified tile location |
| 190 | * | 190 | * |
| 191 | * @param x The x coordinate of the tile to pan to | 191 | * @param x The x coordinate of the tile in the top-left corner to pan to |
| 192 | * @param y The y coordinate of the tile to pan to | 192 | * @param y The y coordinate of the tile in the top-left corner to pan to |
| 193 | * @param length How long (in milliseconds) it will take to pan | 193 | * @param length How long (in milliseconds) it will take to pan |
| 194 | * @param block If true, the game will wait for the pan to complete | 194 | * @param block If true, the game will wait for the pan to complete |
| 195 | * before executing any more commands | 195 | * before executing any more commands |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/AutomaticViewpoint.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/AutomaticViewpoint.java index fbd7e03..1f8a796 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/AutomaticViewpoint.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/AutomaticViewpoint.java | |||
| @@ -17,21 +17,22 @@ import java.awt.Point; | |||
| 17 | public class AutomaticViewpoint implements Viewpoint { | 17 | public class AutomaticViewpoint implements Viewpoint { |
| 18 | 18 | ||
| 19 | private Map map; | 19 | private Map map; |
| 20 | private Point heroLoc; | 20 | private Point heroLoc = new Point(); |
| 21 | private Point viewpoint; | 21 | private Point viewpoint; |
| 22 | 22 | ||
| 23 | public AutomaticViewpoint(Map map) | 23 | public AutomaticViewpoint(Map map) |
| 24 | { | 24 | { |
| 25 | this.map = map; | 25 | this.map = map; |
| 26 | heroLoc = Game.getHeroEvent().getLocation(); | 26 | |
| 27 | refresh(); | 27 | refresh(); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | private void refresh() | 30 | private void refresh() |
| 31 | { | 31 | { |
| 32 | int x,y; | 32 | int x,y; |
| 33 | |||
| 33 | HeroEvent hero = Game.getHeroEvent(); | 34 | HeroEvent hero = Game.getHeroEvent(); |
| 34 | heroLoc = hero.getLocation(); | 35 | heroLoc.setLocation(hero.getLocation()); |
| 35 | 36 | ||
| 36 | Point endLoc = new Point(hero.getLocation()); | 37 | Point endLoc = new Point(hero.getLocation()); |
| 37 | if (hero.isMoving()) | 38 | if (hero.isMoving()) |
| @@ -76,7 +77,7 @@ public class AutomaticViewpoint implements Viewpoint { | |||
| 76 | 77 | ||
| 77 | public int getX() | 78 | public int getX() |
| 78 | { | 79 | { |
| 79 | if (Game.getHeroEvent().getLocation().equals(heroLoc)) | 80 | if (!Game.getHeroEvent().getLocation().equals(heroLoc) || Game.getHeroEvent().isMoving()) |
| 80 | { | 81 | { |
| 81 | refresh(); | 82 | refresh(); |
| 82 | } | 83 | } |
| @@ -86,7 +87,7 @@ public class AutomaticViewpoint implements Viewpoint { | |||
| 86 | 87 | ||
| 87 | public int getY() | 88 | public int getY() |
| 88 | { | 89 | { |
| 89 | if (!Game.getHeroEvent().getLocation().equals(heroLoc)) | 90 | if (!Game.getHeroEvent().getLocation().equals(heroLoc) || Game.getHeroEvent().isMoving()) |
| 90 | { | 91 | { |
| 91 | refresh(); | 92 | refresh(); |
| 92 | } | 93 | } |
