summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java9
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java40
2 files changed, 41 insertions, 8 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java index 78309ae..7beba85 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java
@@ -15,11 +15,4 @@ public interface MovementType {
15 15
16 public Direction nextMovement(); 16 public Direction nextMovement();
17 17
18} 18} \ No newline at end of file
19
20/*
21 CycleUpDown
22 CycleLeftRight
23 StepTowardHero
24 StepAwayFromHero
25*/ \ No newline at end of file
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java new file mode 100644 index 0000000..4c9eb6e --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java
@@ -0,0 +1,40 @@
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.specialmove;
7
8import com.fourisland.fourpuzzle.gamestate.mapview.event.Event;
9import java.awt.Point;
10
11/**
12 *
13 * @author hatkirby
14 */
15public class LoopUntilCollisionMoveEvent implements MoveEvent {
16
17 private Point loc;
18 private MoveEvent[] moves;
19
20 public LoopUntilCollisionMoveEvent(MoveEvent[] moves)
21 {
22 this.moves = moves;
23 }
24
25 public void doAction(Event ev)
26 {
27 loc = new Point();
28
29 while ((loc == null) || (!loc.equals(ev.getLocation())))
30 {
31 loc.setLocation(ev.getLocation());
32
33 for (MoveEvent move : moves)
34 {
35 move.doAction(ev);
36 }
37 }
38 }
39
40}