Compare commits

...

2 Commits

Author SHA1 Message Date
a9bb7df188 fix look at the attack target 2025-11-12 03:20:21 +03:00
1376cf7041 Revert "fix sprite side on attack"
This reverts commit 59f122703302eedf5065110c4e22403eaee0242e.
2025-11-12 03:17:31 +03:00
2 changed files with 12 additions and 3 deletions

View File

@ -24,6 +24,17 @@ function mapBehavior.new(position, size)
}, mapBehavior)
end
--- @param position Vec3
function mapBehavior:lookAt(position)
self.owner:try(Tree.behaviors.sprite,
function(sprite)
if position.x > self.displayedPosition.x then sprite.side = sprite.RIGHT end
-- (sic!)
if position.x < self.displayedPosition.x then sprite.side = sprite.LEFT end
end
)
end
--- @param path Deque
--- @param animationNode AnimationNode
function mapBehavior:followPath(path, animationNode)

View File

@ -124,9 +124,7 @@ function attack:cast(caster, target)
local targetSprite = targetCharacter:has(Tree.behaviors.sprite)
if not sprite or not targetSprite then return true end
if sprite.side == targetSprite.side then
sprite.side = -sprite.side
end
caster:try(Tree.behaviors.map, function(map) map:lookAt(target) end)
AnimationNode {
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,