diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 23:50:44 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 23:50:44 +0100 |
commit | 126c2da904afc5d36184fdbe646642bb9e652211 (patch) | |
tree | fe9b5ab0cf3e611cf3661b3b42acbd1dd31995b5 /core/src/ch/asynk/rustanddust/engine | |
parent | 4073666fdb016572b58d6dbdbd91879ed7abed0e (diff) | |
download | RustAndDust-126c2da904afc5d36184fdbe646642bb9e652211.zip RustAndDust-126c2da904afc5d36184fdbe646642bb9e652211.tar.gz |
DicAnimation: dimension has to be given at construction
Diffstat (limited to 'core/src/ch/asynk/rustanddust/engine')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java index 1a0a3bb..e5a1a02 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/DiceAnimation.java @@ -15,7 +15,6 @@ public class DiceAnimation implements Animation, Drawable { private static final float DURATION = 0.7f; private static final float DURATION_SCATTERING = 0.5f; - private static final int DICE_DIMENSION = 24; private static Random random = new Random(); private static Sprites dice; @@ -37,8 +36,14 @@ public class DiceAnimation implements Animation, Drawable private int[] roll; private float elapsed; private float duration; + private int dimension; // public boolean stop; + public DiceAnimation(int dimension) + { + this.dimension = dimension; + } + public static void init(Texture texture, int cols, int rows, Sound s) { dice = new Sprites(texture, cols, rows); @@ -76,12 +81,12 @@ public class DiceAnimation implements Animation, Drawable public int getWidth() { - return DICE_DIMENSION; + return dimension; } public int getHeight() { - return DICE_DIMENSION; + return dimension; } public void setPosition(float x, float y) @@ -130,7 +135,7 @@ public class DiceAnimation implements Animation, Drawable @Override public void draw(Batch batch) { - batch.draw(dice.frames[frame], x, y, DICE_DIMENSION, DICE_DIMENSION); + batch.draw(dice.frames[frame], x, y, dimension, dimension); } @Override |