summary refs log tree commit diff stats
path: root/src/com
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-14 14:36:14 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-14 14:36:14 -0500
commite50f6fe85fd19d2f91a3877ac99eca234537aac2 (patch)
tree338dd85bb2f7c3a50026cbae5a9e94a93544d40e /src/com
parent41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2 (diff)
downloadfourpuzzle-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')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java12
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/MoveableEventGraphic.java14
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;
10import java.util.ArrayList; 10import java.util.ArrayList;
11import com.fourisland.fourpuzzle.Direction; 11import com.fourisland.fourpuzzle.Direction;
12import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; 12import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic;
13import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.MoveableEventGraphic;
13import com.fourisland.fourpuzzle.gamestate.mapview.event.precondition.Precondition; 14import 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 */
17public class CharSetEventGraphic implements EventGraphic { 17public 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
6package com.fourisland.fourpuzzle.gamestate.mapview.event.graphic;
7
8/**
9 *
10 * @author hatkirby
11 */
12public interface MoveableEventGraphic extends EventGraphic {
13
14}