From: fredboy Date: Mon, 22 Apr 2024 08:44:43 +0000 (+0700) Subject: Fix tools facing wrong direction X-Git-Tag: alpha0.6.1~2 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=26df40fee82cb14e75d757aaee7e31008ff3e46c;p=cavedroid.git Fix tools facing wrong direction --- diff --git a/android/assets/textures/items/iron_axe.png b/android/assets/textures/items/iron_axe.png index 2fd16d0..52113da 100644 Binary files a/android/assets/textures/items/iron_axe.png and b/android/assets/textures/items/iron_axe.png differ diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java index 34a936d..7f517df 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java @@ -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() {