From 331143ef593ce24a76f6caadcd5f9dcce8783fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Oct 2014 23:52:57 +0200 Subject: MoveToAnimation: fix rotation --- android/assets/images/counters.atlas | 68 +++++++++++++++++++++ android/assets/images/counters.png | Bin 153395 -> 288231 bytes android/assets/images/cup.jpg | Bin 12266 -> 0 bytes android/assets/images/dice.pack | 46 -------------- android/assets/images/dice.png | Bin 10986 -> 0 bytes android/assets/images/small.png | Bin 2145 -> 0 bytes android/assets/images/us.atlas | 24 ++++---- android/assets/images/us.png | Bin 322153 -> 316459 bytes build.gradle | 1 + core/src/ch/asynk/tankontank/TankOnTank.java | 6 -- .../engine/gfx/animations/MoveToAnimation.java | 13 +++- data/counters/ace.png | Bin 0 -> 17386 bytes data/counters/ap_1.png | Bin 0 -> 20533 bytes data/counters/ap_2.png | Bin 0 -> 22626 bytes data/counters/ap_3.png | Bin 0 -> 22565 bytes data/counters/ap_4.png | Bin 0 -> 22101 bytes data/counters/ap_spent.png | Bin 0 -> 24185 bytes data/counters/back.png | Bin 0 -> 17872 bytes data/counters/turn_back.png | Bin 0 -> 18221 bytes data/counters/turn_front.png | Bin 0 -> 17210 bytes data/misc/ge-black.png | Bin 0 -> 7787 bytes data/misc/ge-blue.png | Bin 0 -> 2472 bytes data/misc/ge-flag.png | Bin 0 -> 6037 bytes data/misc/ge-green.png | Bin 0 -> 2469 bytes data/misc/ge-red.png | Bin 0 -> 2471 bytes data/misc/images.jpe | Bin 0 -> 9123 bytes data/misc/us-black.png | Bin 0 -> 104031 bytes data/misc/us-blue.png | Bin 0 -> 13200 bytes data/misc/us-flag.png | Bin 0 -> 21857 bytes data/misc/us-green.png | Bin 0 -> 13011 bytes data/misc/us-pawn.png | Bin 0 -> 5881 bytes data/misc/us-red.png | Bin 0 -> 12588 bytes data/us/sherman.png | Bin 13506 -> 4044 bytes 33 files changed, 93 insertions(+), 65 deletions(-) create mode 100644 android/assets/images/counters.atlas delete mode 100644 android/assets/images/cup.jpg delete mode 100644 android/assets/images/dice.pack delete mode 100644 android/assets/images/dice.png delete mode 100644 android/assets/images/small.png create mode 100644 data/counters/ace.png create mode 100644 data/counters/ap_1.png create mode 100644 data/counters/ap_2.png create mode 100644 data/counters/ap_3.png create mode 100644 data/counters/ap_4.png create mode 100644 data/counters/ap_spent.png create mode 100644 data/counters/back.png create mode 100644 data/counters/turn_back.png create mode 100644 data/counters/turn_front.png create mode 100644 data/misc/ge-black.png create mode 100644 data/misc/ge-blue.png create mode 100644 data/misc/ge-flag.png create mode 100644 data/misc/ge-green.png create mode 100644 data/misc/ge-red.png create mode 100644 data/misc/images.jpe create mode 100644 data/misc/us-black.png create mode 100644 data/misc/us-blue.png create mode 100644 data/misc/us-flag.png create mode 100644 data/misc/us-green.png create mode 100644 data/misc/us-pawn.png create mode 100644 data/misc/us-red.png 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 Binary files a/android/assets/images/counters.png and b/android/assets/images/counters.png differ diff --git a/android/assets/images/cup.jpg b/android/assets/images/cup.jpg deleted file mode 100644 index 6f02296..0000000 Binary files a/android/assets/images/cup.jpg and /dev/null 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 Binary files a/android/assets/images/dice.png and /dev/null differ diff --git a/android/assets/images/small.png b/android/assets/images/small.png deleted file mode 100644 index d0c8445..0000000 Binary files a/android/assets/images/small.png and /dev/null 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 Binary files a/android/assets/images/us.png and b/android/assets/images/us.png 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 moveToAnimationPool = new Pool() { @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 Binary files /dev/null and b/data/counters/ace.png differ diff --git a/data/counters/ap_1.png b/data/counters/ap_1.png new file mode 100644 index 0000000..c47d15e Binary files /dev/null and b/data/counters/ap_1.png differ diff --git a/data/counters/ap_2.png b/data/counters/ap_2.png new file mode 100644 index 0000000..e89956a Binary files /dev/null and b/data/counters/ap_2.png differ diff --git a/data/counters/ap_3.png b/data/counters/ap_3.png new file mode 100644 index 0000000..7d1b11f Binary files /dev/null and b/data/counters/ap_3.png differ diff --git a/data/counters/ap_4.png b/data/counters/ap_4.png new file mode 100644 index 0000000..e897628 Binary files /dev/null and b/data/counters/ap_4.png differ diff --git a/data/counters/ap_spent.png b/data/counters/ap_spent.png new file mode 100644 index 0000000..cb399d8 Binary files /dev/null and b/data/counters/ap_spent.png differ diff --git a/data/counters/back.png b/data/counters/back.png new file mode 100644 index 0000000..e7eb5ef Binary files /dev/null and b/data/counters/back.png differ diff --git a/data/counters/turn_back.png b/data/counters/turn_back.png new file mode 100644 index 0000000..3f681d8 Binary files /dev/null and b/data/counters/turn_back.png differ diff --git a/data/counters/turn_front.png b/data/counters/turn_front.png new file mode 100644 index 0000000..b08806b Binary files /dev/null and b/data/counters/turn_front.png differ diff --git a/data/misc/ge-black.png b/data/misc/ge-black.png new file mode 100644 index 0000000..bf00d77 Binary files /dev/null and b/data/misc/ge-black.png differ diff --git a/data/misc/ge-blue.png b/data/misc/ge-blue.png new file mode 100644 index 0000000..b516d7c Binary files /dev/null and b/data/misc/ge-blue.png differ diff --git a/data/misc/ge-flag.png b/data/misc/ge-flag.png new file mode 100644 index 0000000..8c4fc85 Binary files /dev/null and b/data/misc/ge-flag.png differ diff --git a/data/misc/ge-green.png b/data/misc/ge-green.png new file mode 100644 index 0000000..15721f5 Binary files /dev/null and b/data/misc/ge-green.png differ diff --git a/data/misc/ge-red.png b/data/misc/ge-red.png new file mode 100644 index 0000000..cc71025 Binary files /dev/null and b/data/misc/ge-red.png differ diff --git a/data/misc/images.jpe b/data/misc/images.jpe new file mode 100644 index 0000000..7c3516e Binary files /dev/null and b/data/misc/images.jpe differ diff --git a/data/misc/us-black.png b/data/misc/us-black.png new file mode 100644 index 0000000..701dffd Binary files /dev/null and b/data/misc/us-black.png differ diff --git a/data/misc/us-blue.png b/data/misc/us-blue.png new file mode 100644 index 0000000..45962de Binary files /dev/null and b/data/misc/us-blue.png differ diff --git a/data/misc/us-flag.png b/data/misc/us-flag.png new file mode 100644 index 0000000..848149c Binary files /dev/null and b/data/misc/us-flag.png differ diff --git a/data/misc/us-green.png b/data/misc/us-green.png new file mode 100644 index 0000000..90b1435 Binary files /dev/null and b/data/misc/us-green.png differ diff --git a/data/misc/us-pawn.png b/data/misc/us-pawn.png new file mode 100644 index 0000000..f75672c Binary files /dev/null and b/data/misc/us-pawn.png differ diff --git a/data/misc/us-red.png b/data/misc/us-red.png new file mode 100644 index 0000000..4368c72 Binary files /dev/null and b/data/misc/us-red.png differ diff --git a/data/us/sherman.png b/data/us/sherman.png index 4c62be2..cd5cc8f 100644 Binary files a/data/us/sherman.png and b/data/us/sherman.png differ -- cgit v1.1-2-g2b99