diff --git a/scripts/rendering/renderUI.lua b/scripts/rendering/renderUI.lua index 050c2c7..c364d28 100644 --- a/scripts/rendering/renderUI.lua +++ b/scripts/rendering/renderUI.lua @@ -61,6 +61,11 @@ end R.drawBuilding = function(state) local x, y = scripts.helpers.calculations.getCoordinatesFromScreenPosition(love.mouse.getPosition()) local b = scripts.helpers.calculations.hasBuilding(state, x, y) + if CAMERA.buildingFocus then + + b = {building=CAMERA.buildingFocus} + end + if b then love.graphics.setColor(1, 1, 1) diff --git a/scripts/states/showCard.lua b/scripts/states/showCard.lua index 0df70da..d43ad8b 100644 --- a/scripts/states/showCard.lua +++ b/scripts/states/showCard.lua @@ -39,16 +39,34 @@ function menu:draw(b) love.graphics.scale(GLOBSCALE()) scripts.rendering.renderUI.drawCard(menu.state, menu.card) if CANPLAY(menu.state, menu.card) then - love.graphics.draw(ICONS["button-ok"].image, 750, 500, 0, 0.25) + love.graphics.draw(ICONS["button-ok"].image, 750, 455, 0, 0.25) end - love.graphics.draw(ICONS["button-cancel"].image, 710, 500, 0, 0.25) - love.graphics.draw(ICONS["button-trash"].image, 670, 500, 0, 0.25) + love.graphics.draw(ICONS["button-cancel"].image, 710, 455, 0, 0.25) + love.graphics.draw(ICONS["button-trash"].image, 670, 455, 0, 0.25) love.graphics.pop() end end function menu:update(dt, b) + local x, y = love.mouse.getPosition() + local xg, yg = x / GLOBSCALE(), y / GLOBSCALE() + + if xg > 500 and xg < 800 and yg > 100 and yg < 500 then + local c = scripts.gameobjects.cards[STATE.hand[menu.card]] + if c.effects then + local building + for _, effect in pairs(c.effects) do + if effect.type == "place_building" then + building = effect.building + end + end + CAMERA.buildingFocus = building + end + else + CAMERA.buildingFocus = nil + end + menu.prev:update(dt, true) end @@ -56,16 +74,17 @@ function menu:mousepressed(x, y, mouse_btn) if mouse_btn == 1 then local xg, yg = x / GLOBSCALE(), y / GLOBSCALE() - if xg > 750 and xg < 790 and yg > 500 and yg < 540 then + if xg > 750 and xg < 790 and yg > 455 and yg < 495 then startCard(STATE, menu.card, false) end - if xg > 710 and xg < 750 and yg > 500 and yg < 540 then + if xg > 710 and xg < 750 and yg > 455 and yg < 495 then Gamestate.pop() end - if xg > 670 and xg < 710 and yg > 500 and yg < 540 then + if xg > 670 and xg < 710 and yg > 455 and yg < 495 then table.remove(STATE.hand, menu.card) Gamestate.pop() end + local k = scripts.helpers.calculations.getCardNumber(x, y, true) if k then Gamestate.pop()