Compare commits
2 Commits
cd8d2768e0
...
a9bb7df188
| Author | SHA1 | Date | |
|---|---|---|---|
| a9bb7df188 | |||
| 1376cf7041 |
@ -24,6 +24,17 @@ function mapBehavior.new(position, size)
|
|||||||
}, mapBehavior)
|
}, mapBehavior)
|
||||||
end
|
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 path Deque
|
||||||
--- @param animationNode AnimationNode
|
--- @param animationNode AnimationNode
|
||||||
function mapBehavior:followPath(path, animationNode)
|
function mapBehavior:followPath(path, animationNode)
|
||||||
|
|||||||
@ -124,9 +124,7 @@ function attack:cast(caster, target)
|
|||||||
local targetSprite = targetCharacter:has(Tree.behaviors.sprite)
|
local targetSprite = targetCharacter:has(Tree.behaviors.sprite)
|
||||||
if not sprite or not targetSprite then return true end
|
if not sprite or not targetSprite then return true end
|
||||||
|
|
||||||
if sprite.side == targetSprite.side then
|
caster:try(Tree.behaviors.map, function(map) map:lookAt(target) end)
|
||||||
sprite.side = -sprite.side
|
|
||||||
end
|
|
||||||
|
|
||||||
AnimationNode {
|
AnimationNode {
|
||||||
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user