feature/animateTo #21
@ -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"),
|
||||
|
||||
@ -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({
|
||||
|
||||
7
main.lua
7
main.lua
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user