summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/com/fourisland/fourpuzzle/Audio.java7
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java11
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java15
6 files changed, 28 insertions, 11 deletions
diff --git a/src/com/fourisland/fourpuzzle/Audio.java b/src/com/fourisland/fourpuzzle/Audio.java index bc34eda..b364342 100644 --- a/src/com/fourisland/fourpuzzle/Audio.java +++ b/src/com/fourisland/fourpuzzle/Audio.java
@@ -37,6 +37,13 @@ public class Audio {
37 } 37 }
38 })); 38 }));
39 } catch (MidiUnavailableException ex) { 39 } catch (MidiUnavailableException ex) {
40 /* TODO Because of the frequent MIDI unavailability, when
41 * a MIDI sequencer is unavailable, instead of breaking down,
42 * the application should display a message that something
43 * went wrong with the sound and that they should attempt
44 * the game again.
45 */
46
40 Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex); 47 Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex);
41 } 48 }
42 } 49 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 65d2d2d..36406af 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -147,7 +147,7 @@ public class MapViewGameState implements GameState {
147 { 147 {
148 if (!EventHandler.isRunningEvent()) 148 if (!EventHandler.isRunningEvent())
149 { 149 {
150 ev.startMoving(currentMap); 150 ev.startMoving();
151 } 151 }
152 } 152 }
153 } else { 153 } else {
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
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java index e614167..310c2a2 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java
@@ -32,7 +32,7 @@ public interface Event {
32 public void setDirection(Direction direction); 32 public void setDirection(Direction direction);
33 33
34 public boolean isMoving(); 34 public boolean isMoving();
35 public void startMoving(Direction direction); 35 public boolean startMoving(Direction direction);
36 36
37 public Layer getLayer(); 37 public Layer getLayer();
38 38
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index 6201fc8..c88c42b 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java
@@ -90,7 +90,7 @@ public class LayerEvent extends AbstractEvent implements Event {
90 } 90 }
91 } 91 }
92 92
93 public void startMoving(Map map) 93 public void startMoving()
94 { 94 {
95 Direction toMove = getPossibleEvent().getMovement().nextMovement(); 95 Direction toMove = getPossibleEvent().getMovement().nextMovement();
96 96
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java index 74affc4..2f55816 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java
@@ -24,14 +24,15 @@ public class StepMoveEvent implements MoveEvent {
24 24
25 public void doAction(Event ev) 25 public void doAction(Event ev)
26 { 26 {
27 ev.startMoving(direction); 27 if (ev.startMoving(direction))
28
29 while (ev.isMoving())
30 { 28 {
31 try { 29 while (ev.isMoving())
32 Thread.sleep(2); 30 {
33 } catch (InterruptedException ex) { 31 try {
34 Logger.getLogger(StepMoveEvent.class.getName()).log(Level.SEVERE, null, ex); 32 Thread.sleep(2);
33 } catch (InterruptedException ex) {
34 Logger.getLogger(StepMoveEvent.class.getName()).log(Level.SEVERE, null, ex);
35 }
35 } 36 }
36 } 37 }
37 } 38 }