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
rhbvkleef committed Apr 23, 2018
2 parents 9df0a5f + f9413a8 commit b316953
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 16 deletions.
1 change: 0 additions & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion scripts/gameobjects/buildings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ buildings.small_residential = {
}

buildings.medium_residential = {
name = "Appartments",
name = "Apartments",
size = { x = 1, y = 1 },
asset = "medium_residential",
effects = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/gameobjects/cards.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ cards.small_residential = {
}

cards.medium_residential = {
name = "Appartments",
name = "Apartments",
effects = {
{
type = "add_card",
Expand Down
20 changes: 20 additions & 0 deletions scripts/rendering/renderCard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -184,18 +197,25 @@ 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
end
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
Expand Down
8 changes: 4 additions & 4 deletions scripts/rendering/renderMapView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
44 changes: 35 additions & 9 deletions scripts/rendering/renderUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions scripts/states/drawCard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function menu:enter(prev)
menu.showCardDrawAnim = false
end


function menu:draw()
menu.prev:draw(true)

Expand Down

0 comments on commit b316953

Please sign in to comment.