diff --git a/main.lua b/main.lua index 76a1376..ceb60d9 100644 --- a/main.lua +++ b/main.lua @@ -9,7 +9,6 @@ STATE = { properties = { population = 0, money = 40 }, buildings = { { x = 1, y = 1, building = "small_park" }, - }, hand = {}, discardPile = { "small_office", "small_generator", "small_residential"}, diff --git a/scripts/gameobjects/buildings.lua b/scripts/gameobjects/buildings.lua index 8de0e0f..286b09d 100644 --- a/scripts/gameobjects/buildings.lua +++ b/scripts/gameobjects/buildings.lua @@ -196,7 +196,7 @@ buildings.small_residential = { } buildings.medium_residential = { - name = "Appartments", + name = "Apartments", size = { x = 1, y = 1 }, asset = "medium_residential", effects = { diff --git a/scripts/gameobjects/cards.lua b/scripts/gameobjects/cards.lua index 35c79fb..b35a8d2 100644 --- a/scripts/gameobjects/cards.lua +++ b/scripts/gameobjects/cards.lua @@ -121,7 +121,7 @@ cards.small_residential = { } cards.medium_residential = { - name = "Appartments", + name = "Apartments", effects = { { type = "add_card", diff --git a/scripts/rendering/renderCard.lua b/scripts/rendering/renderCard.lua index a7348e3..462308f 100644 --- a/scripts/rendering/renderCard.lua +++ b/scripts/rendering/renderCard.lua @@ -43,9 +43,11 @@ R.renderEventCard = function(card, x, y, scale, building) --named card for copy- love.graphics.setColor(0, 0, 0) if card.requirements then + love.graphics.setFont(fonts["cardSectionTitle"]) if #card.requirements > 0 then love.graphics.print("Requires", (x) / scale + 40, (y) / scale + 38) end + love.graphics.setFont(fonts["cardText"]) for i, requirement in ipairs(card.requirements) do if i == 1 then @@ -55,7 +57,10 @@ R.renderEventCard = function(card, x, y, scale, building) --named card for copy- end if card.effects then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Effects", (x) / scale + 15, (y) / scale + 250) + love.graphics.setFont(fonts["cardText"]) + for i, effect in ipairs(card.effects) do love.graphics.print(scripts.helpers.calculations.effectToString(effect), (x) / scale + 15, (y) / scale + 250 + 20 * i) end @@ -93,7 +98,10 @@ R.renderBuilding = function(card, x, y, scale, building) --named card for copy-p local pfont = love.graphics.getFont() love.graphics.setFont(font) if card.effects then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Effects", (x) / scale + 15, (y) / scale + 190) + love.graphics.setFont(fonts["cardText"]) + for i, effect in ipairs(card.effects) do love.graphics.print(scripts.helpers.calculations.effectToString(effect), (x) / scale + 15, (y) / scale + 190 + 20 * i) end @@ -129,8 +137,10 @@ R.renderCreeper = function(card, x, y, scale) if card.requirements then if #card.requirements > 0 then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Requires", (x) / scale + 40, (y) / scale + 38) end + love.graphics.setFont(fonts["cardText"]) for i, requirement in ipairs(card.requirements) do if i == 1 then @@ -140,7 +150,10 @@ R.renderCreeper = function(card, x, y, scale) end if card.effects then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Effects", (x) / scale + 15, (y) / scale + 250) + love.graphics.setFont(fonts["cardText"]) + for i, effect in ipairs(card.effects) do love.graphics.print(scripts.helpers.calculations.effectToString(effect), (x) / scale + 15, (y) / scale + 250 + 20 * i) end @@ -184,10 +197,14 @@ R.renderBuildingCard = function(card, x, y, scale, building) if card.requirements then if #card.requirements > 0 then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Requires", (x) / scale + 40, (y) / scale + 38) + end + love.graphics.setFont(fonts["cardText"]) for i, requirement in ipairs(card.requirements) do + if i == 1 then love.graphics.print(scripts.helpers.calculations.requirementToString(requirement), (x) / scale + 40, (y) / scale + 38 + 20 * i) end @@ -195,7 +212,10 @@ R.renderBuildingCard = function(card, x, y, scale, building) end if card.effects then + love.graphics.setFont(fonts["cardSectionTitle"]) love.graphics.print("Effects", (x) / scale + 15, (y) / scale + 250) + love.graphics.setFont(fonts["cardText"]) + for i, effect in ipairs(card.effects) do love.graphics.print(scripts.helpers.calculations.effectToString(effect), (x) / scale + 15, (y) / scale + 250 + 20 * i) end diff --git a/scripts/rendering/renderMapView.lua b/scripts/rendering/renderMapView.lua index 7bf3b10..fcc5760 100644 --- a/scripts/rendering/renderMapView.lua +++ b/scripts/rendering/renderMapView.lua @@ -18,13 +18,13 @@ local function addHeli(buildingId) car.y = car.y + dt * 0.3 end if car.direction == 2 then - car.x = car.x + dt * 0.3 + car.x = car.x - dt * 0.3 end if car.direction == 3 then car.y = car.y - dt * 0.3 end - if car.direction == 4 then - car.x = car.x - dt * 0.3 + if car.direction == 0 then + car.x = car.x + dt * 0.3 end helis[buildingId] = car end @@ -60,7 +60,7 @@ mapView.draw = function(lowest) love.graphics.push() love.graphics.scale(GLOBSCALE()) - love.graphics.setColor(0.2, 0.3, 0.2) + love.graphics.setColor(167/256, 188/256, 119/256) love.graphics.rectangle("fill", 0, 0, 1366, 768) love.graphics.setColor(1, 1, 1) for _, v in ipairs(STATE.cars) do diff --git a/scripts/rendering/renderUI.lua b/scripts/rendering/renderUI.lua index c364d28..3031b1f 100644 --- a/scripts/rendering/renderUI.lua +++ b/scripts/rendering/renderUI.lua @@ -34,8 +34,8 @@ R.drawCards = function(state, lowest) end end love.graphics.setColor(1, 1, 1) - scripts.rendering.renderCard.cardBack({ name = "Draw pile\n".. #state.drawPile .." cards" }, 10, 568, 0.5) - scripts.rendering.renderCard.cardBack({ name = "Discard pile\n".. #state.discardPile .." cards" }, 1210, 568, 0.5) + scripts.rendering.renderCard.cardBack({ name = "Draw pile\n" .. #state.drawPile .. " cards" }, 10, 568, 0.5) + scripts.rendering.renderCard.cardBack({ name = "Discard pile\n" .. #state.discardPile .. " cards" }, 1210, 568, 0.5) end R.drawCard = function(state, card, running, fromTheAir) @@ -63,7 +63,7 @@ R.drawBuilding = function(state) local b = scripts.helpers.calculations.hasBuilding(state, x, y) if CAMERA.buildingFocus then - b = {building=CAMERA.buildingFocus} + b = { building = CAMERA.buildingFocus } end if b then @@ -72,7 +72,6 @@ R.drawBuilding = function(state) local building = scripts.gameobjects.buildings[b.building] scripts.rendering.renderCard.renderCard(building, 10, 40, 0.5, true) - end end R.drawStats = function(state) @@ -117,6 +116,33 @@ R.drawStats = function(state) love.graphics.draw(icon.image, offsetX, offsetY, angle, 0.15) end + local x, y = love.mouse.getPosition() + local xg, yg = x/GLOBSCALE(), y / GLOBSCALE() + if yg < 30 then + love.graphics.draw(ICONS.backdrop_top.image, 0, 30, 0, 1, 2) + local str = "" + if xg >200 and xg < 300 then + str = "Population increases if there's enough happiness and enough work" + end + if xg >300 and xg < 400 then + str = "Power is produced by power-generators and consumed by other buildings." + end + if xg >400 and xg < 500 then + str = "Housing is created by residential buildings and apartments." + end + if xg > 500 and xg < 600 then + str = "Work is the number of work not done by people. Negative means unemployment." + end + if xg > 600 and xg < 700 then + str = "Happiness is relaxation minus nuisance minus population." + end + if xg > 700 and xg < 800 then + str = "Money is created by population with work, and is used by buildings (money_per_turn)." + end + love.graphics.setColor(0,0,0) + love.graphics.print(str, 40, 45) + love.graphics.setColor(1,1,1) + end R.updates = {} end @@ -140,19 +166,19 @@ R.updateMove = function(dt) car.y = car.y + dt * 0.3 end if car.direction == 2 then - car.x = car.x + dt * 0.3 + car.x = car.x - dt * 0.3 end if car.direction == 3 then car.y = car.y - dt * 0.3 end - if car.direction == 4 then - car.x = car.x - dt * 0.3 + if car.direction == 0 then + car.x = car.x + dt * 0.3 end car.lifetime = car.lifetime - dt if car.lifetime < 0 then carsToRemove[#carsToRemove + 1] = i end - car.timer = car.timer + 20*dt + car.timer = car.timer + 20 * dt if car.timer > 4 then car.timer = 0 end @@ -236,7 +262,7 @@ function R.mouseReleased(x, y, mouse_btn) end function R.wheelmoved(x, y) - CAMERA.r = CAMERA.r + (y / 10) + CAMERA.r = CAMERA.r + (y / 10) end return R \ No newline at end of file diff --git a/scripts/states/drawCard.lua b/scripts/states/drawCard.lua index 80601f3..6e74937 100644 --- a/scripts/states/drawCard.lua +++ b/scripts/states/drawCard.lua @@ -15,6 +15,7 @@ function menu:enter(prev) menu.showCardDrawAnim = false end + function menu:draw() menu.prev:draw(true)