DEADSOFTWARE

Fix tools facing wrong direction
authorfredboy <fredboy@protonmail.com>
Mon, 22 Apr 2024 08:44:43 +0000 (15:44 +0700)
committerfredboy <fredboy@protonmail.com>
Mon, 22 Apr 2024 09:00:46 +0000 (16:00 +0700)
android/assets/textures/items/iron_axe.png
core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java

index 2fd16d0919456edf70812d6563e82bd0cfc8f2a6..52113da22bc8347f5b785fb537f06d9382865b41 100644 (file)
Binary files a/android/assets/textures/items/iron_axe.png and b/android/assets/textures/items/iron_axe.png differ
index 34a936daaa6aaaca19524ab9f66f2f6f56351654..7f517df7b1ead5f070110a3ad7c50c1863f425ef 100644 (file)
@@ -189,14 +189,18 @@ public class Player extends Mob {
 
         float rotate = anim + 30;
 
+        if (item.isTool()) {
+            sprite.rotate90(looksLeft());
+        }
+
         final float itemX = x + handLength * MathUtils.sin(handMultiplier * anim * MathUtils.degRad) + xOffset;
         final float itemY = y + handLength * MathUtils.cos(handMultiplier * anim * MathUtils.degRad) + yOffset;
 
         if (looksLeft()) {
-            sprite.setFlip(true, sprite.isFlipY());
+            sprite.setFlip(!item.isTool(), sprite.isFlipY());
             SpriteUtilsKt.applyOrigin(sprite, spriteOrigin.getFlipped(true, false));
         } else {
-            sprite.setFlip(false, sprite.isFlipY());
+            sprite.setFlip(item.isTool(), sprite.isFlipY());
             SpriteUtilsKt.applyOrigin(sprite, spriteOrigin);
         }
 
@@ -206,6 +210,7 @@ public class Player extends Mob {
         sprite.setFlip(false, sprite.isFlipY());
         sprite.setRotation(0);
         sprite.setOriginCenter();
+        sprite.rotate90(looksRight());
     }
 
     public void startHitting() {