diff options
Diffstat (limited to 'src/com')
11 files changed, 256 insertions, 8 deletions
| diff --git a/src/com/fourisland/fourpuzzle/PuzzleApplication.java b/src/com/fourisland/fourpuzzle/PuzzleApplication.java index 36dda19..f88b0ad 100755 --- a/src/com/fourisland/fourpuzzle/PuzzleApplication.java +++ b/src/com/fourisland/fourpuzzle/PuzzleApplication.java | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | package com.fourisland.fourpuzzle; | 5 | package com.fourisland.fourpuzzle; |
| 6 | 6 | ||
| 7 | import com.fourisland.fourpuzzle.database.Database; | 7 | import com.fourisland.fourpuzzle.database.Database; |
| 8 | import com.fourisland.fourpuzzle.database.Transitions; | ||
| 8 | import com.fourisland.fourpuzzle.database.Vocabulary; | 9 | import com.fourisland.fourpuzzle.database.Vocabulary; |
| 9 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; | 10 | import com.fourisland.fourpuzzle.gamestate.TitleScreenGameState; |
| 10 | import com.fourisland.fourpuzzle.util.Interval; | 11 | import com.fourisland.fourpuzzle.util.Interval; |
| @@ -104,6 +105,14 @@ public class PuzzleApplication extends Application { | |||
| 104 | { | 105 | { |
| 105 | debugSpeed = true; | 106 | debugSpeed = true; |
| 106 | } | 107 | } |
| 108 | } else if (e.getKeyCode() == KeyEvent.VK_F12) | ||
| 109 | { | ||
| 110 | try { | ||
| 111 | /* If the user presses F12, return to the title screen */ | ||
| 112 | Display.transition(Database.getTransition(Transitions.Generic), new TitleScreenGameState(), false); | ||
| 113 | } catch (InterruptedException ex) { | ||
| 114 | Thread.currentThread().interrupt(); | ||
| 115 | } | ||
| 107 | } else { | 116 | } else { |
| 108 | // If anything else is pressed, let the GameState handle it | 117 | // If anything else is pressed, let the GameState handle it |
| 109 | KeyboardInput.getKey().keyInput(e); | 118 | KeyboardInput.getKey().keyInput(e); |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index ec35db6..89fac99 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java | |||
| @@ -25,6 +25,7 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventTh | |||
| 25 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; | 25 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; |
| 26 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; | 26 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; |
| 27 | import com.fourisland.fourpuzzle.gamestate.menu.MenuGameState; | 27 | import com.fourisland.fourpuzzle.gamestate.menu.MenuGameState; |
| 28 | import java.awt.Color; | ||
| 28 | import java.awt.Graphics2D; | 29 | import java.awt.Graphics2D; |
| 29 | import java.awt.event.KeyEvent; | 30 | import java.awt.event.KeyEvent; |
| 30 | import java.awt.image.BufferedImage; | 31 | import java.awt.image.BufferedImage; |
| @@ -260,6 +261,11 @@ public class MapViewGameState implements GameState { | |||
| 260 | int x = currentViewpoint.getX(); | 261 | int x = currentViewpoint.getX(); |
| 261 | int y = currentViewpoint.getY(); | 262 | int y = currentViewpoint.getY(); |
| 262 | 263 | ||
| 264 | /* Fill the background with black so specialized viewpoints that go off | ||
| 265 | * the screen such as ShakingViewpoint render properly */ | ||
| 266 | g.setColor(Color.BLACK); | ||
| 267 | g.fillRect(0, 0, Game.WIDTH, Game.HEIGHT); | ||
| 268 | |||
| 263 | // Render the lower layer of the map | 269 | // Render the lower layer of the map |
| 264 | g.drawImage(currentMap.renderLower(), 0, 0, Game.WIDTH, Game.HEIGHT, x, y, x+Game.WIDTH, y+Game.HEIGHT, null); | 270 | g.drawImage(currentMap.renderLower(), 0, 0, Game.WIDTH, Game.HEIGHT, x, y, x+Game.WIDTH, y+Game.HEIGHT, null); |
| 265 | 271 | ||
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java index e9482f9..aa2c3b3 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java | |||
| @@ -218,4 +218,15 @@ public abstract class AbstractEvent implements Event { | |||
| 218 | { | 218 | { |
| 219 | return moveSpeed; | 219 | return moveSpeed; |
| 220 | } | 220 | } |
| 221 | |||
| 222 | private MoveFrequency freq; | ||
| 223 | public void setFrequency(MoveFrequency freq) | ||
| 224 | { | ||
| 225 | this.freq = freq; | ||
| 226 | } | ||
| 227 | |||
| 228 | public MoveFrequency getFrequency() | ||
| 229 | { | ||
| 230 | return freq; | ||
| 231 | } | ||
| 221 | } | 232 | } |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java index 0cda403..936394b 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java | |||
| @@ -51,4 +51,7 @@ public interface Event { | |||
| 51 | 51 | ||
| 52 | public void setMoveSpeed(MoveSpeed moveSpeed); | 52 | public void setMoveSpeed(MoveSpeed moveSpeed); |
| 53 | public MoveSpeed getMoveSpeed(); | 53 | public MoveSpeed getMoveSpeed(); |
| 54 | |||
| 55 | public void setFrequency(MoveFrequency freq); | ||
| 56 | public MoveFrequency getFrequency(); | ||
| 54 | } | 57 | } |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index 5db87a0..1df6c1d 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java | |||
| @@ -25,6 +25,7 @@ public class HeroEvent extends AbstractEvent implements Event { | |||
| 25 | { | 25 | { |
| 26 | setLocation(new Point()); | 26 | setLocation(new Point()); |
| 27 | setMoveSpeed(MoveSpeed.Faster); | 27 | setMoveSpeed(MoveSpeed.Faster); |
| 28 | setFrequency(MoveFrequency.EIGHT); | ||
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | public String getLabel() | 31 | public String getLabel() |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index 9788b2e..afaf923 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java | |||
| @@ -12,6 +12,7 @@ import com.fourisland.fourpuzzle.Direction; | |||
| 12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; | 12 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.BlankEventGraphic; |
| 13 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.MoveableEventGraphic; | 13 | import com.fourisland.fourpuzzle.gamestate.mapview.event.graphic.MoveableEventGraphic; |
| 14 | import com.fourisland.fourpuzzle.gamestate.mapview.event.precondition.Precondition; | 14 | import com.fourisland.fourpuzzle.gamestate.mapview.event.precondition.Precondition; |
| 15 | import com.fourisland.fourpuzzle.util.PauseTimer; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * | 18 | * |
| @@ -97,15 +98,21 @@ public class LayerEvent extends AbstractEvent implements Event { | |||
| 97 | } | 98 | } |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 101 | PauseTimer pt = new PauseTimer(0); | ||
| 100 | public void startMoving() | 102 | public void startMoving() |
| 101 | { | 103 | { |
| 102 | Direction toMove = getPossibleEvent().getMovement().nextMovement(new ImmutableEvent(this)); | 104 | if (pt.isElapsed()) |
| 103 | |||
| 104 | if (toMove != null) | ||
| 105 | { | 105 | { |
| 106 | if (getPossibleEvent().getGraphic() instanceof MoveableEventGraphic) | 106 | pt.setTimer(getFrequency().getFrequency()-1); |
| 107 | |||
| 108 | Direction toMove = getPossibleEvent().getMovement().nextMovement(new ImmutableEvent(this)); | ||
| 109 | |||
| 110 | if (toMove != null) | ||
| 107 | { | 111 | { |
| 108 | startMoving(toMove); | 112 | if (getPossibleEvent().getGraphic() instanceof MoveableEventGraphic) |
| 113 | { | ||
| 114 | startMoving(toMove); | ||
| 115 | } | ||
| 109 | } | 116 | } |
| 110 | } | 117 | } |
| 111 | } | 118 | } |
| @@ -169,4 +176,16 @@ public class LayerEvent extends AbstractEvent implements Event { | |||
| 169 | return getPossibleEvent().getMoveSpeed(); | 176 | return getPossibleEvent().getMoveSpeed(); |
| 170 | } | 177 | } |
| 171 | 178 | ||
| 179 | @Override | ||
| 180 | public void setFrequency(MoveFrequency freq) | ||
| 181 | { | ||
| 182 | getPossibleEvent().setFrequency(freq); | ||
| 183 | } | ||
| 184 | |||
| 185 | @Override | ||
| 186 | public MoveFrequency getFrequency() | ||
| 187 | { | ||
| 188 | return getPossibleEvent().getFrequency(); | ||
| 189 | } | ||
| 190 | |||
| 172 | } \ No newline at end of file | 191 | } \ No newline at end of file |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java new file mode 100644 index 0000000..3e3cc0e --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * | ||
| 10 | * @author hatkirby | ||
| 11 | */ | ||
| 12 | public enum MoveFrequency { | ||
| 13 | |||
| 14 | EIGHT(1), | ||
| 15 | SEVEN(2), | ||
| 16 | SIX(3), | ||
| 17 | FIVE(4), | ||
| 18 | FOUR(5), | ||
| 19 | THREE(6), | ||
| 20 | TWO(7), | ||
| 21 | ONE(8); | ||
| 22 | |||
| 23 | private int freq; | ||
| 24 | private MoveFrequency(int freq) | ||
| 25 | { | ||
| 26 | this.freq = freq; | ||
| 27 | } | ||
| 28 | |||
| 29 | public int getFrequency() | ||
| 30 | { | ||
| 31 | return freq; | ||
| 32 | } | ||
| 33 | |||
| 34 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java index 7f255dd..3f35943 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java | |||
| @@ -25,6 +25,7 @@ public class PossibleEvent { | |||
| 25 | private AnimationType animation; | 25 | private AnimationType animation; |
| 26 | private MovementType movement; | 26 | private MovementType movement; |
| 27 | private MoveSpeed moveSpeed; | 27 | private MoveSpeed moveSpeed; |
| 28 | private MoveFrequency freq; | ||
| 28 | private EventCallTime calltime; | 29 | private EventCallTime calltime; |
| 29 | private EventCall callback; | 30 | private EventCall callback; |
| 30 | 31 | ||
| @@ -44,6 +45,7 @@ public class PossibleEvent { | |||
| 44 | private AnimationType animation = AnimationType.CommonWithoutStepping; | 45 | private AnimationType animation = AnimationType.CommonWithoutStepping; |
| 45 | private MovementType movement = new StayStillMovementType(); | 46 | private MovementType movement = new StayStillMovementType(); |
| 46 | private MoveSpeed moveSpeed = MoveSpeed.Normal; | 47 | private MoveSpeed moveSpeed = MoveSpeed.Normal; |
| 48 | private MoveFrequency freq = MoveFrequency.EIGHT; | ||
| 47 | private EventCallTime calltime = EventCallTime.PushKey; | 49 | private EventCallTime calltime = EventCallTime.PushKey; |
| 48 | private EventCall callback = EventCall.getEmptyEventCall(); | 50 | private EventCall callback = EventCall.getEmptyEventCall(); |
| 49 | 51 | ||
| @@ -77,6 +79,12 @@ public class PossibleEvent { | |||
| 77 | return this; | 79 | return this; |
| 78 | } | 80 | } |
| 79 | 81 | ||
| 82 | public Builder freq(MoveFrequency freq) | ||
| 83 | { | ||
| 84 | this.freq = freq; | ||
| 85 | return this; | ||
| 86 | } | ||
| 87 | |||
| 80 | public Builder calltime(EventCallTime calltime) | 88 | public Builder calltime(EventCallTime calltime) |
| 81 | { | 89 | { |
| 82 | this.calltime = calltime; | 90 | this.calltime = calltime; |
| @@ -102,6 +110,7 @@ public class PossibleEvent { | |||
| 102 | animation = builder.animation; | 110 | animation = builder.animation; |
| 103 | movement = builder.movement; | 111 | movement = builder.movement; |
| 104 | moveSpeed = builder.moveSpeed; | 112 | moveSpeed = builder.moveSpeed; |
| 113 | freq = builder.freq; | ||
| 105 | calltime = builder.calltime; | 114 | calltime = builder.calltime; |
| 106 | callback = builder.callback; | 115 | callback = builder.callback; |
| 107 | } | 116 | } |
| @@ -114,6 +123,7 @@ public class PossibleEvent { | |||
| 114 | .animation(animation) | 123 | .animation(animation) |
| 115 | .movement(movement) | 124 | .movement(movement) |
| 116 | .speed(moveSpeed) | 125 | .speed(moveSpeed) |
| 126 | .freq(freq) | ||
| 117 | .calltime(calltime) | 127 | .calltime(calltime) |
| 118 | .callback(callback) | 128 | .callback(callback) |
| 119 | .build(); | 129 | .build(); |
| @@ -154,6 +164,16 @@ public class PossibleEvent { | |||
| 154 | { | 164 | { |
| 155 | return moveSpeed; | 165 | return moveSpeed; |
| 156 | } | 166 | } |
| 167 | |||
| 168 | void setFrequency(MoveFrequency freq) | ||
| 169 | { | ||
| 170 | this.freq = freq; | ||
| 171 | } | ||
| 172 | |||
| 173 | public MoveFrequency getFrequency() | ||
| 174 | { | ||
| 175 | return freq; | ||
| 176 | } | ||
| 157 | 177 | ||
| 158 | private boolean moving = false; | 178 | private boolean moving = false; |
| 159 | void setMoving(boolean moving) | 179 | void setMoving(boolean moving) |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index ca3ba5e..2db33f7 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |||
| @@ -16,6 +16,8 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventTh | |||
| 16 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; | 16 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; |
| 17 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.FixedViewpoint; | 17 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.FixedViewpoint; |
| 18 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.MovingViewpoint; | 18 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.MovingViewpoint; |
| 19 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.ShakingViewpoint; | ||
| 20 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.ShakingViewpoint.ShakeSpeed; | ||
| 19 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; | 21 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; |
| 20 | import com.fourisland.fourpuzzle.transition.InTransition; | 22 | import com.fourisland.fourpuzzle.transition.InTransition; |
| 21 | import com.fourisland.fourpuzzle.transition.OutTransition; | 23 | import com.fourisland.fourpuzzle.transition.OutTransition; |
| @@ -366,4 +368,52 @@ public class SpecialEvent { | |||
| 366 | throw new InterruptedException(); | 368 | throw new InterruptedException(); |
| 367 | } | 369 | } |
| 368 | 370 | ||
| 371 | /** | ||
| 372 | * Shake the screen like an earthquake | ||
| 373 | * | ||
| 374 | * @param speed How fast the screen should shake | ||
| 375 | * @param length The amount of time (in milliseconds) the shaking should | ||
| 376 | * last | ||
| 377 | * @param block If true, the game will wait for the shaking to complete | ||
| 378 | * before executing any more commands | ||
| 379 | * @throws java.lang.InterruptedException | ||
| 380 | */ | ||
| 381 | public void ShakeScreen(ShakeSpeed speed, int length, final boolean block) throws InterruptedException | ||
| 382 | { | ||
| 383 | Viewpoint viewpoint = mapView.getViewpoint(); | ||
| 384 | final CountDownLatch blocker; | ||
| 385 | |||
| 386 | if (block) | ||
| 387 | { | ||
| 388 | blocker = new CountDownLatch(1); | ||
| 389 | } else { | ||
| 390 | blocker = null; | ||
| 391 | } | ||
| 392 | |||
| 393 | mapView.setViewpoint(new ShakingViewpoint(viewpoint.getX(), viewpoint.getY(), speed, length, new Runnable() { | ||
| 394 | public void run() | ||
| 395 | { | ||
| 396 | if (block) | ||
| 397 | { | ||
| 398 | blocker.countDown(); | ||
| 399 | } else { | ||
| 400 | ResetViewpoint(); | ||
| 401 | } | ||
| 402 | } | ||
| 403 | })); | ||
| 404 | |||
| 405 | if (block) | ||
| 406 | { | ||
| 407 | try | ||
| 408 | { | ||
| 409 | blocker.await(); | ||
| 410 | } catch (InterruptedException ex) | ||
| 411 | { | ||
| 412 | throw ex; | ||
| 413 | } finally { | ||
| 414 | ResetViewpoint(); | ||
| 415 | } | ||
| 416 | } | ||
| 417 | } | ||
| 418 | |||
| 369 | } | 419 | } |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/ShakingViewpoint.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/ShakingViewpoint.java new file mode 100644 index 0000000..f2b40e7 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/viewpoint/ShakingViewpoint.java | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | * To change this template, choose Tools | Templates | ||
| 3 | * and open the template in the editor. | ||
| 4 | */ | ||
| 5 | |||
| 6 | package com.fourisland.fourpuzzle.gamestate.mapview.viewpoint; | ||
| 7 | |||
| 8 | import com.fourisland.fourpuzzle.util.Interval; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * | ||
| 12 | * @author hatkirby | ||
| 13 | */ | ||
| 14 | public class ShakingViewpoint implements Viewpoint { | ||
| 15 | |||
| 16 | int sx; | ||
| 17 | int length; | ||
| 18 | int x; | ||
| 19 | int y; | ||
| 20 | ShakeSpeed speed; | ||
| 21 | Interval in; | ||
| 22 | Runnable callback; | ||
| 23 | boolean back = false; | ||
| 24 | long start; | ||
| 25 | public ShakingViewpoint(int x, int y, ShakeSpeed speed, int length, Runnable callback) | ||
| 26 | { | ||
| 27 | this.sx = x; | ||
| 28 | this.length = length; | ||
| 29 | this.x = x; | ||
| 30 | this.y = y; | ||
| 31 | this.in = Interval.createMillisInterval(1000 / speed.getSpeed()); | ||
| 32 | this.speed = speed; | ||
| 33 | this.callback = callback; | ||
| 34 | this.start = System.currentTimeMillis(); | ||
| 35 | } | ||
| 36 | |||
| 37 | private void refresh() | ||
| 38 | { | ||
| 39 | if (back) | ||
| 40 | { | ||
| 41 | x -= speed.getSpeed(); | ||
| 42 | |||
| 43 | if (x < sx - 16) | ||
| 44 | { | ||
| 45 | back = false; | ||
| 46 | } | ||
| 47 | } else { | ||
| 48 | x += speed.getSpeed(); | ||
| 49 | |||
| 50 | if (x > sx + 16) | ||
| 51 | { | ||
| 52 | back = true; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | if (start + length <= System.currentTimeMillis()) | ||
| 57 | { | ||
| 58 | callback.run(); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 | public int getX() | ||
| 63 | { | ||
| 64 | if (in.isElapsed()) | ||
| 65 | { | ||
| 66 | refresh(); | ||
| 67 | } | ||
| 68 | |||
| 69 | return x; | ||
| 70 | } | ||
| 71 | |||
| 72 | public int getY() | ||
| 73 | { | ||
| 74 | return y; | ||
| 75 | } | ||
| 76 | |||
| 77 | public static enum ShakeSpeed | ||
| 78 | { | ||
| 79 | Slow(16), | ||
| 80 | Medium(24), | ||
| 81 | Fast(32); | ||
| 82 | |||
| 83 | private int speed; | ||
| 84 | private ShakeSpeed(int speed) | ||
| 85 | { | ||
| 86 | this.speed = speed; | ||
| 87 | } | ||
| 88 | |||
| 89 | public int getSpeed() | ||
| 90 | { | ||
| 91 | return speed; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | } | ||
| diff --git a/src/com/fourisland/fourpuzzle/util/Interval.java b/src/com/fourisland/fourpuzzle/util/Interval.java index 3383a39..1e5e8f3 100755 --- a/src/com/fourisland/fourpuzzle/util/Interval.java +++ b/src/com/fourisland/fourpuzzle/util/Interval.java | |||
| @@ -22,12 +22,12 @@ public class Interval { | |||
| 22 | 22 | ||
| 23 | public static Interval createTickInterval(float ticks) | 23 | public static Interval createTickInterval(float ticks) |
| 24 | { | 24 | { |
| 25 | return createMillisInterval((int) (Game.FPS * ticks)); | 25 | return createMillisInterval(Game.FPS * ticks); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | public static Interval createMillisInterval(int millis) | 28 | public static Interval createMillisInterval(float millis) |
| 29 | { | 29 | { |
| 30 | return new Interval(millis*1000000); | 30 | return new Interval((int) (millis*1000000)); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | private long last = System.nanoTime(); | 33 | private long last = System.nanoTime(); |
