summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-03 23:52:57 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-03 23:52:57 +0200
commit331143ef593ce24a76f6caadcd5f9dcce8783fb5 (patch)
tree884e9bdf48321b9e15d28812eba40d6223d1d98a
parentc4d43b7a87bab33f1486af3d6ace82750026d0f9 (diff)
downloadRustAndDust-331143ef593ce24a76f6caadcd5f9dcce8783fb5.zip
RustAndDust-331143ef593ce24a76f6caadcd5f9dcce8783fb5.tar.gz
MoveToAnimation: fix rotation
-rw-r--r--android/assets/images/counters.atlas68
-rw-r--r--android/assets/images/counters.pngbin153395 -> 288231 bytes
-rw-r--r--android/assets/images/cup.jpgbin12266 -> 0 bytes
-rw-r--r--android/assets/images/dice.pack46
-rw-r--r--android/assets/images/dice.pngbin10986 -> 0 bytes
-rw-r--r--android/assets/images/small.pngbin2145 -> 0 bytes
-rw-r--r--android/assets/images/us.atlas24
-rw-r--r--android/assets/images/us.pngbin322153 -> 316459 bytes
-rw-r--r--build.gradle1
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java13
-rw-r--r--data/counters/ace.pngbin0 -> 17386 bytes
-rw-r--r--data/counters/ap_1.pngbin0 -> 20533 bytes
-rw-r--r--data/counters/ap_2.pngbin0 -> 22626 bytes
-rw-r--r--data/counters/ap_3.pngbin0 -> 22565 bytes
-rw-r--r--data/counters/ap_4.pngbin0 -> 22101 bytes
-rw-r--r--data/counters/ap_spent.pngbin0 -> 24185 bytes
-rw-r--r--data/counters/back.pngbin0 -> 17872 bytes
-rw-r--r--data/counters/turn_back.pngbin0 -> 18221 bytes
-rw-r--r--data/counters/turn_front.pngbin0 -> 17210 bytes
-rw-r--r--data/misc/ge-black.pngbin0 -> 7787 bytes
-rw-r--r--data/misc/ge-blue.pngbin0 -> 2472 bytes
-rw-r--r--data/misc/ge-flag.pngbin0 -> 6037 bytes
-rw-r--r--data/misc/ge-green.pngbin0 -> 2469 bytes
-rw-r--r--data/misc/ge-red.pngbin0 -> 2471 bytes
-rw-r--r--data/misc/images.jpebin0 -> 9123 bytes
-rw-r--r--data/misc/us-black.pngbin0 -> 104031 bytes
-rw-r--r--data/misc/us-blue.pngbin0 -> 13200 bytes
-rw-r--r--data/misc/us-flag.pngbin0 -> 21857 bytes
-rw-r--r--data/misc/us-green.pngbin0 -> 13011 bytes
-rw-r--r--data/misc/us-pawn.pngbin0 -> 5881 bytes
-rw-r--r--data/misc/us-red.pngbin0 -> 12588 bytes
-rw-r--r--data/us/sherman.pngbin13506 -> 4044 bytes
33 files changed, 93 insertions, 65 deletions
diff --git a/android/assets/images/counters.atlas b/android/assets/images/counters.atlas
new file mode 100644
index 0000000..9f0de4a
--- /dev/null
+++ b/android/assets/images/counters.atlas
@@ -0,0 +1,68 @@
+
+counters.png
+format: RGBA8888
+filter: Nearest,Nearest
+repeat: none
+ace
+ rotate: false
+ xy: 2, 128
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: -1
+ap
+ rotate: false
+ xy: 2, 2
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: 1
+ap
+ rotate: false
+ xy: 128, 128
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: 2
+ap
+ rotate: false
+ xy: 128, 2
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: 3
+ap
+ rotate: false
+ xy: 254, 128
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: 4
+ap_spent
+ rotate: false
+ xy: 254, 2
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: -1
+back
+ rotate: false
+ xy: 380, 128
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: -1
+turn_back
+ rotate: false
+ xy: 380, 2
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: -1
+turn_front
+ rotate: false
+ xy: 506, 128
+ size: 124, 124
+ orig: 124, 124
+ offset: 0, 0
+ index: -1
diff --git a/android/assets/images/counters.png b/android/assets/images/counters.png
index b9bbb0d..1b493f9 100644
--- a/android/assets/images/counters.png
+++ b/android/assets/images/counters.png
Binary files differ
diff --git a/android/assets/images/cup.jpg b/android/assets/images/cup.jpg
deleted file mode 100644
index 6f02296..0000000
--- a/android/assets/images/cup.jpg
+++ /dev/null
Binary files differ
diff --git a/android/assets/images/dice.pack b/android/assets/images/dice.pack
deleted file mode 100644
index 0e8385a..0000000
--- a/android/assets/images/dice.pack
+++ /dev/null
@@ -1,46 +0,0 @@
-dice.png
-format: RGBA8888
-filter: Nearest,Nearest
-repeat: none
-d1
- rotate: false
- xy: 1, 1
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 1
-d2
- rotate: false
- xy: 31, 1
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 2
-d3
- rotate: false
- xy: 61, 1
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 3
-d4
- rotate: false
- xy: 1, 31
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 4
-d5
- rotate: false
- xy: 31, 31
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 5
-d6
- rotate: false
- xy: 61, 31
- size: 30, 30
- orig: 30, 30
- offset: 0, 0
- index: 6
diff --git a/android/assets/images/dice.png b/android/assets/images/dice.png
deleted file mode 100644
index 0ce9454..0000000
--- a/android/assets/images/dice.png
+++ /dev/null
Binary files differ
diff --git a/android/assets/images/small.png b/android/assets/images/small.png
deleted file mode 100644
index d0c8445..0000000
--- a/android/assets/images/small.png
+++ /dev/null
Binary files differ
diff --git a/android/assets/images/us.atlas b/android/assets/images/us.atlas
index e60ff69..9f7f164 100644
--- a/android/assets/images/us.atlas
+++ b/android/assets/images/us.atlas
@@ -5,70 +5,70 @@ filter: Nearest,Nearest
repeat: none
at-gun
rotate: false
- xy: 473, 128
+ xy: 346, 280
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
head
rotate: false
- xy: 2, 77
+ xy: 2, 10
size: 175, 175
orig: 175, 175
offset: 0, 0
index: -1
infantry
rotate: false
- xy: 599, 128
+ xy: 472, 280
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
pershing
rotate: false
- xy: 851, 128
+ xy: 724, 280
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
pershing-hq
rotate: false
- xy: 725, 128
+ xy: 598, 280
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
priest
rotate: false
- xy: 473, 2
+ xy: 850, 280
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
sherman
rotate: false
- xy: 331, 112
- size: 140, 140
- orig: 140, 140
+ xy: 2, 187
+ size: 190, 217
+ orig: 190, 217
offset: 0, 0
index: -1
sherman-head
rotate: false
- xy: 179, 102
+ xy: 194, 254
size: 150, 150
orig: 150, 150
offset: 0, 0
index: -1
sherman-hq
rotate: false
- xy: 599, 2
+ xy: 194, 128
size: 124, 124
orig: 124, 124
offset: 0, 0
index: -1
wolverine
rotate: false
- xy: 725, 2
+ xy: 179, 2
size: 124, 124
orig: 124, 124
offset: 0, 0
diff --git a/android/assets/images/us.png b/android/assets/images/us.png
index 11743cb..5fe8f07 100644
--- a/android/assets/images/us.png
+++ b/android/assets/images/us.png
Binary files differ
diff --git a/build.gradle b/build.gradle
index 292b9b7..a354fe6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -42,6 +42,7 @@ allprojects {
add 'ge'
add 'hex'
add 'unit'
+ add 'counters'
}
}
}
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index c2283dc..49cd23b 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -32,14 +32,11 @@ public class TankOnTank extends Game
Gdx.app.debug("TankOnTank", " load assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
manager.load("images/map_a.png", Texture.class);
manager.load("images/map_b.png", Texture.class);
- manager.load("images/dice.pack", TextureAtlas.class);
manager.load("images/counters.pack", TextureAtlas.class);
manager.load("images/ge.atlas", TextureAtlas.class);
manager.load("images/us.atlas", TextureAtlas.class);
manager.load("images/hex.atlas", TextureAtlas.class);
manager.load("images/unit.atlas", TextureAtlas.class);
- // manager.load("images/cup.jpg", Texture.class);
- // manager.load("images/small.png", Texture.class);
}
public void unloadAssets()
@@ -48,14 +45,11 @@ public class TankOnTank extends Game
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
manager.unload("images/map_a.png");
manager.unload("images/map_b.png");
- manager.unload("images/dice.pack");
manager.unload("images/counters.pack");
manager.unload("images/ge.atlas");
manager.unload("images/us.atlas");
manager.unload("images/hex.atlas");
manager.unload("images/unit.atlas");
- // manager.unload("images/cup.jpg");
- // manager.unload("images/small.png");
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
}
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java
index 9a48db4..aa2e630 100644
--- a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java
+++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java
@@ -14,6 +14,7 @@ public class MoveToAnimation extends TimedAnimation
private float toX;
private float toY;
private float toR;
+ private float rDelta;
private static final Pool<MoveToAnimation> moveToAnimationPool = new Pool<MoveToAnimation>() {
@Override
@@ -36,6 +37,7 @@ public class MoveToAnimation extends TimedAnimation
a.toY = y;
a.toR = r;
a.duration = duration;
+ a.rDelta = 0;
return a;
}
@@ -58,6 +60,15 @@ public class MoveToAnimation extends TimedAnimation
fromX = pawn.getX();
fromY = pawn.getY();
fromR = pawn.getRotation();
+
+ if (Math.abs(toR - fromR) <= 180.f)
+ rDelta = (toR - fromR);
+ else {
+ if (toR > fromR)
+ rDelta = (toR - 360 - fromR);
+ else
+ rDelta = (toR + 360 - fromR);
+ }
}
@Override
@@ -72,6 +83,6 @@ public class MoveToAnimation extends TimedAnimation
if (percent == 1f)
pawn.setPosition(toX, toY, (int) toR);
else
- pawn.setPosition(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (int) (fromR + ((toR - fromR) * percent)));
+ pawn.setPosition(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (fromR + (rDelta * percent)));
}
}
diff --git a/data/counters/ace.png b/data/counters/ace.png
new file mode 100644
index 0000000..f4f3240
--- /dev/null
+++ b/data/counters/ace.png
Binary files differ
diff --git a/data/counters/ap_1.png b/data/counters/ap_1.png
new file mode 100644
index 0000000..c47d15e
--- /dev/null
+++ b/data/counters/ap_1.png
Binary files differ
diff --git a/data/counters/ap_2.png b/data/counters/ap_2.png
new file mode 100644
index 0000000..e89956a
--- /dev/null
+++ b/data/counters/ap_2.png
Binary files differ
diff --git a/data/counters/ap_3.png b/data/counters/ap_3.png
new file mode 100644
index 0000000..7d1b11f
--- /dev/null
+++ b/data/counters/ap_3.png
Binary files differ
diff --git a/data/counters/ap_4.png b/data/counters/ap_4.png
new file mode 100644
index 0000000..e897628
--- /dev/null
+++ b/data/counters/ap_4.png
Binary files differ
diff --git a/data/counters/ap_spent.png b/data/counters/ap_spent.png
new file mode 100644
index 0000000..cb399d8
--- /dev/null
+++ b/data/counters/ap_spent.png
Binary files differ
diff --git a/data/counters/back.png b/data/counters/back.png
new file mode 100644
index 0000000..e7eb5ef
--- /dev/null
+++ b/data/counters/back.png
Binary files differ
diff --git a/data/counters/turn_back.png b/data/counters/turn_back.png
new file mode 100644
index 0000000..3f681d8
--- /dev/null
+++ b/data/counters/turn_back.png
Binary files differ
diff --git a/data/counters/turn_front.png b/data/counters/turn_front.png
new file mode 100644
index 0000000..b08806b
--- /dev/null
+++ b/data/counters/turn_front.png
Binary files differ
diff --git a/data/misc/ge-black.png b/data/misc/ge-black.png
new file mode 100644
index 0000000..bf00d77
--- /dev/null
+++ b/data/misc/ge-black.png
Binary files differ
diff --git a/data/misc/ge-blue.png b/data/misc/ge-blue.png
new file mode 100644
index 0000000..b516d7c
--- /dev/null
+++ b/data/misc/ge-blue.png
Binary files differ
diff --git a/data/misc/ge-flag.png b/data/misc/ge-flag.png
new file mode 100644
index 0000000..8c4fc85
--- /dev/null
+++ b/data/misc/ge-flag.png
Binary files differ
diff --git a/data/misc/ge-green.png b/data/misc/ge-green.png
new file mode 100644
index 0000000..15721f5
--- /dev/null
+++ b/data/misc/ge-green.png
Binary files differ
diff --git a/data/misc/ge-red.png b/data/misc/ge-red.png
new file mode 100644
index 0000000..cc71025
--- /dev/null
+++ b/data/misc/ge-red.png
Binary files differ
diff --git a/data/misc/images.jpe b/data/misc/images.jpe
new file mode 100644
index 0000000..7c3516e
--- /dev/null
+++ b/data/misc/images.jpe
Binary files differ
diff --git a/data/misc/us-black.png b/data/misc/us-black.png
new file mode 100644
index 0000000..701dffd
--- /dev/null
+++ b/data/misc/us-black.png
Binary files differ
diff --git a/data/misc/us-blue.png b/data/misc/us-blue.png
new file mode 100644
index 0000000..45962de
--- /dev/null
+++ b/data/misc/us-blue.png
Binary files differ
diff --git a/data/misc/us-flag.png b/data/misc/us-flag.png
new file mode 100644
index 0000000..848149c
--- /dev/null
+++ b/data/misc/us-flag.png
Binary files differ
diff --git a/data/misc/us-green.png b/data/misc/us-green.png
new file mode 100644
index 0000000..90b1435
--- /dev/null
+++ b/data/misc/us-green.png
Binary files differ
diff --git a/data/misc/us-pawn.png b/data/misc/us-pawn.png
new file mode 100644
index 0000000..f75672c
--- /dev/null
+++ b/data/misc/us-pawn.png
Binary files differ
diff --git a/data/misc/us-red.png b/data/misc/us-red.png
new file mode 100644
index 0000000..4368c72
--- /dev/null
+++ b/data/misc/us-red.png
Binary files differ
diff --git a/data/us/sherman.png b/data/us/sherman.png
index 4c62be2..cd5cc8f 100644
--- a/data/us/sherman.png
+++ b/data/us/sherman.png
Binary files differ