diff --git a/include/Engine/SpriteAnimator.hpp b/include/Engine/SpriteAnimator.hpp index 61a18bf..bf611ec 100644 --- a/include/Engine/SpriteAnimator.hpp +++ b/include/Engine/SpriteAnimator.hpp @@ -68,8 +68,11 @@ class SpriteAnimator return pSheet == nullptr || isEnd; } - bool isMouseOver(Vec2i cursorPos) + bool isMouseOver(Vec2i cursorPos, bool flip) { + if (flip) + cursorPos.x = (pSheet->getWidth() / pSheet->getTileCount()) - cursorPos.x - 1; + cursorPos.x += indexCurrentAnimSprite * pSheet->getWidth() / pSheet->getTileCount(); return pSheet != nullptr ? pSheet->isPixelOpaque(cursorPos) : false; } diff --git a/include/Game/Pet.hpp b/include/Game/Pet.hpp index 7a7d977..2b75c9b 100644 --- a/include/Game/Pet.hpp +++ b/include/Game/Pet.hpp @@ -510,7 +510,7 @@ class Pet floor(datas.cursorPos.x / (float)(datas.scale * spriteAnimator.getSheet()->getSizeFactor()))), static_cast( floor(datas.cursorPos.y / (float)(datas.scale * spriteAnimator.getSheet()->getSizeFactor())))}; - return spriteAnimator.isMouseOver(localCursoPos); + return spriteAnimator.isMouseOver(localCursoPos, !datas.side); } else {