Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nanderv committed Apr 23, 2018
2 parents f47ef4d + 207f454 commit 885b5b4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
16 changes: 8 additions & 8 deletions scripts/rendering/renderUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ R.drawMessage = function(message)
love.graphics.setColor(1, 1, 1)
end
local iconOffset = function(index)
return 200 + (70 * index)
return 200 + (100 * index)
end
R.drawBuilding = function(state)
local x, y = scripts.helpers.calculations.getCoordinatesFromScreenPosition(love.mouse.getPosition())
Expand All @@ -82,20 +82,20 @@ R.drawStats = function(state)
love.graphics.draw(ICONS.happiness.image, iconOffset(4), .5, 0, 0.15)
love.graphics.draw(ICONS.money.image, iconOffset(5), .5, 0, 0.15)
love.graphics.setColor(0, 0, 0)
love.graphics.print(state.properties.population, iconOffset(0) + 35, 7)
love.graphics.print(gamerules.getExcessPower(state), iconOffset(1) + 35, 7)
love.graphics.print(gamerules.getTotalHousing(state), iconOffset(2) + 35, 7)
love.graphics.print(gamerules.getAvailableJobs(state), iconOffset(3) + 35, 7)
love.graphics.print(gamerules.getHappiness(state), iconOffset(4) + 35, 7)
love.graphics.print(state.properties.money, iconOffset(5) + 35, 7)
love.graphics.print(state.properties.population, iconOffset(0) + 35, 1)
love.graphics.print(gamerules.getExcessPower(state), iconOffset(1) + 35, 1)
love.graphics.print(gamerules.getTotalHousing(state), iconOffset(2) + 35, 1)
love.graphics.print(gamerules.getAvailableJobs(state), iconOffset(3) + 35, 1)
love.graphics.print(gamerules.getHappiness(state), iconOffset(4) + 35, 1)
love.graphics.print(state.properties.money, iconOffset(5) + 35, 1)
love.graphics.setColor(1, 1, 1)
love.graphics.setDefaultFilter("nearest", "nearest")

local offsets = { population = 0, energy = 1, housing = 2, work = 3, happiness = 4, money = 5 }
for _, update in ipairs(R.updates) do
local m = update:gmatch("[^_]+")
local type, direction, color = m(), m(), m()
local offsetX = iconOffset(offsets[type]) + 45
local offsetX = iconOffset(offsets[type]) + 60
local offsetY = 0.5
local angle = 0
if color == "red" and direction == "up" then
Expand Down
11 changes: 8 additions & 3 deletions scripts/states/endOfTurn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
--
local menu = {} -- previously: Gamestate.new()
menu.name = "endOfTurn"
menu.is_ran = false
function menu:enter(prev)
menu.prev = prev
menu.changes, menu.creepers = scripts.helpers.gamerules.endTurn(STATE)
scripts.helpers.gamerules.startTurn(STATE)
if not menu.is_ran then
menu.changes, menu.creepers = scripts.helpers.gamerules.endTurn(STATE)
scripts.helpers.gamerules.startTurn(STATE)
menu.is_ran = true
end
-- setup entities here
menu.t = 0.3
end
Expand All @@ -21,7 +25,7 @@ end
function menu:update(dt)
scripts.rendering.renderUI.updateMove(dt)
if #menu.creepers > 0 then
Gamestate.push(scripts.states.showCreepers, menu.creepers)
Gamestate.push(scripts.states.showCreepers, menu.creepers, menu.changes)
menu.creepers = {}
else
menu.t = menu.t - dt
Expand All @@ -31,6 +35,7 @@ function menu:update(dt)
menu.t = 0.7
local c = STATE.hand[1]
if not c then
menu.is_ran = false
Gamestate.switch(scripts.states.dealHand)
else
STATE.discardPile[#STATE.discardPile+1] = c
Expand Down
7 changes: 6 additions & 1 deletion scripts/states/showCreepers.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local menu = {} -- previously: Gamestate.new()
menu.name = "showCreepers"
function menu:enter(prev, cards)
function menu:enter(prev, cards, changes)
menu.prev = prev
menu.cards = cards
menu.changes = changes
end

local offsets = {
Expand All @@ -26,6 +27,10 @@ function menu:draw()
end
end

function menu:update()
scripts.rendering.renderUI.drawUpdates(menu.changes)
end

function menu:mousepressed(x, y, click)
for i = 1, math.min(#offsets, #menu.cards) do
for k, card in pairs(scripts.gameobjects.cards) do
Expand Down

0 comments on commit 885b5b4

Please sign in to comment.