summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-01-28 16:45:55 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-01-28 16:45:55 -0500
commit7171798052557dab8b3e6febfc027bf5b1b52941 (patch)
treed22dbab17de7b84614b364ea916ca123a6fd41b2 /src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java
parent8f46c097bf0b3cf314af62a66428e04043d0a61f (diff)
downloadfourpuzzle-7171798052557dab8b3e6febfc027bf5b1b52941.tar.gz
fourpuzzle-7171798052557dab8b3e6febfc027bf5b1b52941.tar.bz2
fourpuzzle-7171798052557dab8b3e6febfc027bf5b1b52941.zip
Fixed off-screen bug
If an Event is adjacent to a Map boundary, then it could accidentally walk off the screen during the following circumstance: When a MoveEvent() action tells said Event to move off-screen while the Event is already moving, collision checking will be bypassed and the Event will proceed to walk off the screen, after which an Exception will be thrown when said Event attempts to move again. This bug has been fixed.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java index a0f4e10..c0ea634 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java
@@ -41,8 +41,13 @@ public abstract class AbstractEvent implements Event {
41 } 41 }
42 42
43 private int moveTimer; 43 private int moveTimer;
44 public void startMoving(Direction toMove) 44 public boolean startMoving(Direction toMove)
45 { 45 {
46 if (isMoving())
47 {
48 return false;
49 }
50
46 setDirection(toMove); 51 setDirection(toMove);
47 52
48 if (!getParentMap().checkForCollision(this, toMove)) 53 if (!getParentMap().checkForCollision(this, toMove))
@@ -50,6 +55,10 @@ public abstract class AbstractEvent implements Event {
50 setAnimationStep(2); 55 setAnimationStep(2);
51 moveTimer = 4; 56 moveTimer = 4;
52 setMoving(true); 57 setMoving(true);
58
59 return true;
60 } else {
61 return false;
53 } 62 }
54 } 63 }
55 64