now you can make moves only when your turn
This commit is contained in:
parent
369e7db7e0
commit
73d8f6a3a5
@ -18,7 +18,8 @@ controls.keymap = {
|
|||||||
cameraMoveDown = control("key", "s"),
|
cameraMoveDown = control("key", "s"),
|
||||||
cameraMoveScroll = control("mouse", "3"),
|
cameraMoveScroll = control("mouse", "3"),
|
||||||
fullMana = control("key", "m"),
|
fullMana = control("key", "m"),
|
||||||
select = control("mouse", "1")
|
select = control("mouse", "1"),
|
||||||
|
endTurnTest = control("key", "e")
|
||||||
}
|
}
|
||||||
|
|
||||||
local currentKeys = {}
|
local currentKeys = {}
|
||||||
|
|||||||
@ -25,6 +25,8 @@ function selector:update(dt)
|
|||||||
local selectedId = Tree.level.characterGrid:get(Vec3 { mousePosition.x, mousePosition.y })
|
local selectedId = Tree.level.characterGrid:get(Vec3 { mousePosition.x, mousePosition.y })
|
||||||
|
|
||||||
if not self.id then
|
if not self.id then
|
||||||
|
-- print(selectedId, Tree.level.turnOrder.order[1])
|
||||||
|
if selectedId ~= Tree.level.turnOrder.order[1] then return end
|
||||||
return self:select(selectedId)
|
return self:select(selectedId)
|
||||||
else
|
else
|
||||||
local char = Tree.level.characters[self.id]
|
local char = Tree.level.characters[self.id]
|
||||||
|
|||||||
@ -52,8 +52,6 @@ function walk:cast(caster, target)
|
|||||||
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
||||||
}:run()
|
}:run()
|
||||||
|
|
||||||
Tree.level.turnOrder:next()
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
7
main.lua
7
main.lua
@ -25,6 +25,13 @@ function love.update(dt)
|
|||||||
Widgets:update(dt) -- логика UI-слоя должна отработать раньше всех, потому что нужно перехватить жесты и не пустить их дальше
|
Widgets:update(dt) -- логика UI-слоя должна отработать раньше всех, потому что нужно перехватить жесты и не пустить их дальше
|
||||||
Tree.panning:update(dt)
|
Tree.panning:update(dt)
|
||||||
Tree.level:update(dt)
|
Tree.level:update(dt)
|
||||||
|
|
||||||
|
-- для тестов очереди ходов
|
||||||
|
-- удалить как только появится ui для людей
|
||||||
|
if Tree.controls:isJustPressed("endTurnTest") then
|
||||||
|
Tree.level.turnOrder:next()
|
||||||
|
end
|
||||||
|
|
||||||
Tree.controls:cache()
|
Tree.controls:cache()
|
||||||
|
|
||||||
local t2 = love.timer.getTime()
|
local t2 = love.timer.getTime()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user