summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java40
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java7
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java8
5 files changed, 53 insertions, 6 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 3283da5..3acfff4 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -134,7 +134,7 @@ public class MapViewGameState implements GameState {
134 { 134 {
135 if (Functions.isFacing(hero, ev)) 135 if (Functions.isFacing(hero, ev))
136 { 136 {
137 ev.setDirection(hero.getDirection().oppositeDirection()); 137 ev.setDirection(hero.getDirection().opposite());
138 ev.getCallback().activate(ev.getCalltime()); 138 ev.getCallback().activate(ev.getCalltime());
139 } 139 }
140 } else { 140 } else {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java index 483ce49..2933fff 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java
@@ -78,7 +78,7 @@ public abstract class AbstractEvent implements Event {
78 } else if (moveTimer == 0) 78 } else if (moveTimer == 0)
79 { 79 {
80 setAnimationStep(1); 80 setAnimationStep(1);
81 moving = false; 81 setMoving(false);
82 82
83 if (getDirection() == Direction.North) 83 if (getDirection() == Direction.North)
84 { 84 {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java index 7824470..4c3aeb9 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java
@@ -46,10 +46,44 @@ public enum AnimationType {
46 /** 46 /**
47 * An AnimationType that does not allow the Event to turn or animate. 47 * An AnimationType that does not allow the Event to turn or animate.
48 */ 48 */
49 FixedGraphic(false, false); 49 FixedGraphic(false, false),
50 /**
51 * An AnimationType that is identical to CommonWithoutStepping except that
52 * it causes the Event in question to continually rotate counterclockwise.
53 */
54 TurnLeft(true, true)
55 {
56 Interval in = Interval.createTickInterval(2);
57
58 @Override
59 public void tick(PossibleEvent pe)
60 {
61 if (in.isElapsed())
62 {
63 pe.setDirection(pe.getDirection().left());
64 }
65 }
66 },
67 /**
68 * An AnimationType that is identical to CommonWithoutStepping except that
69 * it causes the Event in question to continually rotate clockwise.
70 */
71 TurnRight(true, true)
72 {
73 Interval in = Interval.createTickInterval(2);
74
75 @Override
76 public void tick(PossibleEvent pe)
77 {
78 if (in.isElapsed())
79 {
80 pe.setDirection(pe.getDirection().right());
81 }
82 }
83 };
50 84
51 private boolean canTurn; 85 private final boolean canTurn;
52 private boolean canStep; 86 private final boolean canStep;
53 private AnimationType(boolean canTurn, boolean canStep) 87 private AnimationType(boolean canTurn, boolean canStep)
54 { 88 {
55 this.canTurn = canTurn; 89 this.canTurn = canTurn;
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index e57d7f8..3c826cb 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java
@@ -132,4 +132,11 @@ public class LayerEvent extends AbstractEvent implements Event {
132 return getPossibleEvent().getAnimationStep(); 132 return getPossibleEvent().getAnimationStep();
133 } 133 }
134 134
135 @Override
136 public void setMoving(boolean moving)
137 {
138 super.setMoving(moving);
139 getPossibleEvent().setMoving(moving);
140 }
141
135} \ No newline at end of file 142} \ No newline at end of file
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java index f31dcaf..a8c3a51 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java
@@ -119,6 +119,12 @@ public class PossibleEvent {
119 return movement; 119 return movement;
120 } 120 }
121 121
122 private boolean moving = false;
123 void setMoving(boolean moving)
124 {
125 this.moving = moving;
126 }
127
122 Direction getDirection() 128 Direction getDirection()
123 { 129 {
124 return direction; 130 return direction;
@@ -126,7 +132,7 @@ public class PossibleEvent {
126 132
127 void setDirection(Direction direction) 133 void setDirection(Direction direction)
128 { 134 {
129 if (animation.canTurn()) 135 if (animation.canTurn() && !moving)
130 { 136 {
131 this.direction = direction; 137 this.direction = direction;
132 graphic.setDirection(direction); 138 graphic.setDirection(direction);