summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-07 13:15:06 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-07 13:15:06 -0500
commite8e617ed1465073d59a9e5eea9f0cc6c15058d49 (patch)
treebf7af353d64ae505ab9ffe8e5dc1f4910934496b /src/com/fourisland/fourpuzzle/gamestate/mapview/event
parentb5ff6fcc1e572d1a6150ee2af159be68ee2c2a94 (diff)
downloadfourpuzzle-e8e617ed1465073d59a9e5eea9f0cc6c15058d49.tar.gz
fourpuzzle-e8e617ed1465073d59a9e5eea9f0cc6c15058d49.tar.bz2
fourpuzzle-e8e617ed1465073d59a9e5eea9f0cc6c15058d49.zip
Implemented all AnimationTypes
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java56
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java27
2 files changed, 73 insertions, 10 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java index e7901df..20d6bfc 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AnimationType.java
@@ -10,10 +10,54 @@ package com.fourisland.fourpuzzle.gamestate.mapview.event;
10 * @author hatkirby 10 * @author hatkirby
11 */ 11 */
12public enum AnimationType { 12public enum AnimationType {
13 CommonWithoutStepping, 13 /**
14 CommonWithStepping, 14 * The default AnimationType, it allows the Event to turn and to animate
15 WithoutStepping, 15 * while it walks, but it only animates while it moves.
16 FixedGraphic, 16 */
17 TurnLeft, 17 CommonWithoutStepping(true, true, false),
18 TurnRight 18 /**
19 * An AnimationType which allows the Event to turn and to animate. It will
20 * animate at all times, even while stationary.
21 */
22 CommonWithStepping(true, true, true),
23 /**
24 * An AnimationType that allows the Event to turn, but not to animate.
25 */
26 WithoutStepping(true, false, false),
27 /**
28 * An AnimationType that does not allow the Event to turn or animate.
29 */
30 FixedGraphic(false, false, false);
31
32 private boolean canTurn;
33 private boolean canStep;
34 private boolean alwaysStepping;
35 private AnimationType(boolean canTurn, boolean canStep, boolean alwaysStepping)
36 {
37 this.canTurn = canTurn;
38 this.canStep = canStep;
39
40 if (!canStep)
41 {
42 this.alwaysStepping = false;
43 } else {
44 this.alwaysStepping = alwaysStepping;
45 }
46 }
47
48 public boolean canTurn()
49 {
50 return canTurn;
51 }
52
53 public boolean canStep()
54 {
55 return canStep;
56 }
57
58 public boolean isAlwaysStepping()
59 {
60 return alwaysStepping;
61 }
62
19} 63}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java index c18385d..5ba887b 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java
@@ -13,7 +13,6 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraph
13import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic; 13import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.EventGraphic;
14import com.fourisland.fourpuzzle.gamestate.mapview.event.movement.MovementType; 14import com.fourisland.fourpuzzle.gamestate.mapview.event.movement.MovementType;
15import com.fourisland.fourpuzzle.gamestate.mapview.event.movement.StayStillMovementType; 15import com.fourisland.fourpuzzle.gamestate.mapview.event.movement.StayStillMovementType;
16import com.fourisland.fourpuzzle.util.Functions;
17import java.awt.image.BufferedImage; 16import java.awt.image.BufferedImage;
18 17
19/** 18/**
@@ -52,7 +51,24 @@ public class PossibleEvent {
52 return graphic.getImage(); 51 return graphic.getImage();
53 } 52 }
54 53
54 private boolean aSLC = false;
55 public EventGraphic getGraphic() { 55 public EventGraphic getGraphic() {
56 if (animation.isAlwaysStepping())
57 {
58 if (aSLC)
59 {
60 aSLC = false;
61
62 if (animationStep == 0)
63 {
64 setAnimationStep(2);
65 } else {
66 setAnimationStep(animationStep-1);
67 }
68 } else {
69 aSLC = true;
70 }
71 }
56 return graphic; 72 return graphic;
57 } 73 }
58 74
@@ -90,7 +106,7 @@ public class PossibleEvent {
90 106
91 public void setDirection(Direction direction) 107 public void setDirection(Direction direction)
92 { 108 {
93 if (Functions.canTurn(this)) 109 if (animation.canTurn())
94 { 110 {
95 this.direction = direction; 111 this.direction = direction;
96 graphic.setDirection(direction); 112 graphic.setDirection(direction);
@@ -102,8 +118,11 @@ public class PossibleEvent {
102 } 118 }
103 119
104 public void setAnimationStep(int animationStep) { 120 public void setAnimationStep(int animationStep) {
105 this.animationStep = animationStep; 121 if (animation.canStep())
106 graphic.setAnimationStep(animationStep); 122 {
123 this.animationStep = animationStep;
124 graphic.setAnimationStep(animationStep);
125 }
107 } 126 }
108 127
109 public void addPrecondition(Precondition precondition) 128 public void addPrecondition(Precondition precondition)