Files
ludoconfiture/world.lua
2025-12-28 18:46:34 +01:00

84 lines
1.2 KiB
Lua

ressources =
{
fruits =
{
quantity = 5,
sprite = 33,
x = 70
},
money =
{
quantity = 100,
sprite = 35,
x = 0
},
jam =
{
quantity = 0,
sprite = 34,
x = 100
}
}
buildings = {
jam_workshop =
{
sprite = 1,
inputs = {
{fruit = 2}
},
outputs = {jam = 3}
},
city =
{
sprite = 5,
inputs = {},
outputs = {}
},
}
function draw_ressource_bar()
rectfill(0, 0, 127, 7, 1)
for _,res in pairs(ressources) do
spr(res.sprite, res.x, 0)
print(res.quantity, res.x + 8, 1, 6)
end
end
function updatecycle()
end
function compute_effect_array(array)
for obj in all(array) do
obj.compute_effet(obj)
end
end
function draw_array(array)
for obj in all(array) do
obj.draw(obj)
end
end
function new_worldtile(x, y, building)
local worldtile = {}
worldtile.x = x
worldtile.y = y
worldtile.building = building
worldtile.draw = function(this)
spr(worldtile.bulding.sprite,worldtile.x*2*8,8+worldtile.y*2*8, 2, 2)
end
worldtile.compute_effet = function(this)
for _,input in pairs(worldtile.building.inputs) do
--input.
end
end
return worldtile
end