From af19fd5898d839e1976f34960b21f8dfc2dd77eb Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Fri, 20 Mar 2009 09:30:10 -0400 Subject: Engine: Added ChangeFrequencyMoveEvent Closes #17 --- .../specialmove/ChangeFrequencyMoveEvent.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java new file mode 100644 index 0000000..58117a5 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/ChangeFrequencyMoveEvent.java @@ -0,0 +1,36 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove; + +import com.fourisland.fourpuzzle.gamestate.mapview.event.Event; +import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent; + +/** + * ChangeFrequencyMoveEvent changes the walk frequency of an event; in other + * words, it changes how how often this event will initiate movement. The event + * must be a LayerEvent and the frequency must be larger than or equal to 1. + * + * @author hatkirby + */ +public class ChangeFrequencyMoveEvent implements MoveEvent { + + private int freq; + public ChangeFrequencyMoveEvent(int freq) + { + this.freq = freq; + } + + public void doAction(Event ev) + { + if (!(ev instanceof LayerEvent)) + { + throw new IllegalArgumentException(""); + } + + ((LayerEvent) ev).setFrequency(freq); + } + +} -- cgit 1.4.1