init camera:animateTo

This commit is contained in:
neckrat 2025-11-09 18:58:01 +03:00
parent c16870102b
commit cdffff59c3
3 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,7 @@ controls.keymap = {
cameraMoveRight = control("key", "d"),
cameraMoveDown = control("key", "s"),
cameraMoveScroll = control("mouse", "3"),
cameraAnimateTo = control('key', 't'),
fullMana = control("key", "m"),
select = control("mouse", "1"),
endTurnTest = control("key", "e"),

View File

@ -87,6 +87,11 @@ function camera:detach()
love.graphics.pop()
end
--- @param position Vec3
function camera:animateTo(position)
self.position = position
end
--- @return Camera
local function new()
return setmetatable({

View File

@ -40,6 +40,13 @@ function love.update(dt)
Tree.level.turnOrder:toggleTurns()
end
-- для тестов camera:attachTo
-- удалить как только потребность в тестах исчезнет
if Tree.controls:isJustPressed("cameraAnimateTo") then
local mousePosition = Tree.level.camera:toWorldPosition(Vec3 { love.mouse.getX(), love.mouse.getY() })
Tree.level.camera:animateTo(mousePosition)
end
Tree.controls:cache()
local t2 = love.timer.getTime()