summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java40
1 files changed, 40 insertions, 0 deletions
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}