diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-14 14:36:14 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-14 14:36:14 -0500 |
commit | e50f6fe85fd19d2f91a3877ac99eca234537aac2 (patch) | |
tree | 338dd85bb2f7c3a50026cbae5a9e94a93544d40e /src/com | |
parent | 41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2 (diff) | |
download | fourpuzzle-e50f6fe85fd19d2f91a3877ac99eca234537aac2.tar.gz fourpuzzle-e50f6fe85fd19d2f91a3877ac99eca234537aac2.tar.bz2 fourpuzzle-e50f6fe85fd19d2f91a3877ac99eca234537aac2.zip |
Engine: Restricted LayerEvent moving
Now, LayerEvents can only move if their current PossibleEvent has a MoveableEventGraphic.
Diffstat (limited to 'src/com')
3 files changed, 27 insertions, 1 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index 5ff2ed1..1bbe3bb 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java | |||
@@ -10,6 +10,7 @@ import java.awt.Graphics; | |||
10 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
11 | import com.fourisland.fourpuzzle.Direction; | 11 | import com.fourisland.fourpuzzle.Direction; |
12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; | 12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; |
13 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.MoveableEventGraphic; | ||
13 | import com.fourisland.fourpuzzle.gamestate.mapview.event.precondition.Precondition; | 14 | import com.fourisland.fourpuzzle.gamestate.mapview.event.precondition.Precondition; |
14 | 15 | ||
15 | /** | 16 | /** |
@@ -94,6 +95,17 @@ public class LayerEvent extends AbstractEvent implements Event { | |||
94 | } | 95 | } |
95 | } | 96 | } |
96 | 97 | ||
98 | @Override | ||
99 | public boolean startMoving(Direction toMove) | ||
100 | { | ||
101 | if (!(getPossibleEvent().getGraphic() instanceof MoveableEventGraphic)) | ||
102 | { | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | return super.startMoving(toMove); | ||
107 | } | ||
108 | |||
97 | public Direction getDirection() | 109 | public Direction getDirection() |
98 | { | 110 | { |
99 | return getPossibleEvent().getDirection(); | 111 | return getPossibleEvent().getDirection(); |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java index 6064f24..1f2ee1a 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java | |||
@@ -14,7 +14,7 @@ import java.awt.image.BufferedImage; | |||
14 | * | 14 | * |
15 | * @author hatkirby | 15 | * @author hatkirby |
16 | */ | 16 | */ |
17 | public class CharSetEventGraphic implements EventGraphic { | 17 | public class CharSetEventGraphic implements MoveableEventGraphic { |
18 | 18 | ||
19 | private Direction direction = Direction.South; | 19 | private Direction direction = Direction.South; |
20 | private int animationStep = 1; | 20 | private int animationStep = 1; |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/MoveableEventGraphic.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/MoveableEventGraphic.java new file mode 100644 index 0000000..3c57181 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/MoveableEventGraphic.java | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.fourpuzzle.gamestate.mapview.event.graphic; | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | * @author hatkirby | ||
11 | */ | ||
12 | public interface MoveableEventGraphic extends EventGraphic { | ||
13 | |||
14 | } | ||