Poll

What should I add next?

Worker Huts
9 (9.5%)
Hospitals
4 (4.2%)
Jails
4 (4.2%)
Warehouses
4 (4.2%)
Re-implement Farms and Crops
11 (11.6%)
Make the new graphics selectable without editing the .love file.
6 (6.3%)
Village Upgrades (Or upgrades in general)
15 (15.8%)
AI
39 (41.1%)
Other (State your idea in a post)
3 (3.2%)

Total Members Voted: 95

Author Topic: IsoLand - An Isometric Civilization-style Game (abandoned)  (Read 30356 times)

i'll work on it when I feel like it

not really dedicating my life to it lawl
Oh, ok. I'll try and keep this alive for you then :3

i'll work on it when I feel like it

not really dedicating my life to it lawl
bad you.


ohmygodthisgamelookssoamazing,assoonasigetontomycomputerimdownloadindit.

Just to sum up my main suggestions;
- AI
- AI towns (starter towns where you can sell resources for a more RPG look?)
- More buildings

This does sound a little like MySims, come to think of it.


Just a thought - you should make the executable one file.
never mind

/facedesk

INSPIRATION

Y U NO REVOLVE AROUND ME

Add fields. Like, tall grass fields.

You've already got a big list of stuff to add, right?

You've already got a big list of stuff to add, right?
yes

but like

i don't feel like it

lol


lazy :U
that's my point

lol

deciding on whether or not to re-code it for the upteenth time since I just made a forgetload of awesome libraries and the current state of it is just a huge clusterforget I don't feel like organizing

that's my point

lol

deciding on whether or not to re-code it for the upteenth time since I just made a forgetload of awesome libraries and the current state of it is just a huge clusterforget I don't feel like organizing
Add new stuff maan

Add new stuff maan
doesn't really answer my question

unless you mean to continue piling onto the mound of stuff that is IsoLand2

in fact let me show you some of the code

Code: [Select]
function loadscripts(dir)
local scripts = love.filesystem.enumerate(dir)
for i,v in pairs(scripts) do
if love.filesystem.isFile(dir..v) then
require(dir..v)
end
end
end

function love.draw()
if landscape == nil then landscape = getImg("landscape.png") end
-- love.graphics.draw(landscape,0,0)

draw_fog()
draw_map()
draw_menu()
draw_messages()
draw_mouse()
draw_help()

local wood = getImg("icon_Wood.png")
local ore = getImg("icon_Stone.png")
local fish = getImg("icon_Fish.png")
local pop = getImg("icon_Person.png")

love.graphics.draw(wood,0,0)
love.graphics.draw(ore,0,32)
love.graphics.draw(fish,0,64)
love.graphics.draw(pop,0,96)

love.graphics.print(" : "..g.wood,32,8)
love.graphics.print(" : "..g.ore,32,40)
love.graphics.print(" : "..g.fish,32,72)
love.graphics.print(" : "..g.pop.."/"..g.maxpop,32,104)

love.graphics.setFont(font.normal)
love.graphics.printf(
"IsoLand \n"..
"Created by Kingdaro \n"..
'Press "h" for help \n'..
"\n"..
-- (gettilename(tiles[g.select])).."\n"..
love.timer.getFPS().." FPS"
,0,0,800,'right')
end

--is stupid and is not working for some stupid reason
function gettilename(tile)
if tile ~= nil then
return ""
else
return tile.name
end
end

function love.update(dt)
process(dt)
update_messages(dt)
update_help(dt)
if g.controls then
update_camera(dt)
update_minetime(dt)
update_fishtime(dt)
update_pop(dt)
update_mouseselect(dt)
end
end

function love.keypressed(key)
-- select_tile(key)
update_menu(key)
open_help(key)
end

function love.mousepressed(x,y,b)
toggle_menu(x,y,b)
end

function sort()
local tile = tiles[g.select]
local x1 = tile.x
local y1 = tile.y

table.sort(tiles,
function(a, b)
return b.x+b.y > a.x+a.y
end
)

for i,v in pairs(tiles) do
local x2 = v.x
local y2 = v.y
if x1 == x2 and y1 == y2 then
g.select = i
end
end
end

function distance(x1,x2,y1,y2)
return math.sqrt((x1-x2)^2 + (y1-y2)^2)
end

function love.load()
--=Global Variables=--
g = {}

g.select = 1
g.wood = 80
g.ore = 50
g.crops = 0
g.fish = 0
g.food = 0
g.maxcrops = 0
g.seeds = 0
g.pop = 0
g.maxpop = 0
g.controls = true
g.menu = false
g.menuselect = 1
g.help = false
--

--=Fonts=--
font = {}

font.normal = love.graphics.newFont(12)
font.menu = love.graphics.newFont(24)
font.help = 20
--

loadscripts("Scripts/")
startgame()
sort()

colors = {62,164,255}
love.graphics.setBackgroundColor(colors)
love.graphics.setCaption("IsoLand")
love.mouse.setVisible(false)

math.randomseed(os.time())

tilescroll = getSound("landScroll.wav")
end

function limit_max(value,max)
if value > max then
return max
else
return value
end
end

function limit_min(value,min)
if value < min then
return min
else
return value
end
end





















--lol, space

main.lua, right there

possibly because I might run out of space, here's clusterforget #2, objects.lua

which pretty much controls the properties of the tiles and stuff

Code: [Select]

--=Tiles=--
tiles = {}
types = {}

function addtile(x,y,props,elev)
ok = true
for i,v in pairs(tiles) do
if v.x == x and v.y == y then
ok = false
end
end
if ok then
local tile = {}
tile.name = props.name
tile.x = x
tile.y = y
tile.img = props.img
tile.life = props.life
tile.process = false
tile.build = nil
tile.menu = props.menu
tile.elev = elev
table.insert(tiles, tile)
end
end

function process(dt)
local check = 0
for i,tile in pairs(tiles) do
if tile.process == true then
if tile.life <= 0 then
tile.process = false
tile.build(tile)
g.controls = true
else
tile.life = tile.life - dt
end
check = check + 1
end
end
if check >= 1 then
g.controls = false
else
if not g.menu or g.help then
g.controls = true
end
end
end

function set_properties(tile,props)
tile.name = props.name
tile.img = props.img
tile.life = props.life
tile.process = false
tile.build = nil
tile.menu = props.menu
end

function invalid_option()
newmessage("Feature not yet implemented.")
end

function tile_count(name)
local count = 0
for i,tile in pairs(tiles) do
if tile.name == name then
count = count + 1
end
end
return count
end

function startgame()
addtile(0,0,grass.properties,1)
addtile(1,0,grass.properties,2)
addtile(2,0,grass.properties,3)
addtile(3,0,grass.properties,4)
addtile(4,0,grass.properties,5)
end

function define_tile(name,id,img,funct)
local tile = {}
tile.name = name
tile.img = img
tile.funct = funct
table.insert(types,id,tile)
end

define_tile("Grass",1,getImg("grass.png"),
function ()
print("FASFFFFF")
end
)
--


--Grass--
grass = {}

grass.img = getImg("grass.png")

function grass.village(tile)
if tile.process == false then
if g.wood >= 50 and g.ore >= 30 then
tile.build = grass.village2
tile.process = true
g.wood = g.wood-50
g.ore = g.ore-30
g.maxpop = g.maxpop+16
newmessage("-50 Wood\n-30 Ore\nConstructing Village...")
else
newmessage("50 wood and 30 ore is needed to build a village.")
end
end
end

function grass.village2(tile)
set_properties(tile,village.properties)
newmessage("Your village has been built!")
end

function grass.farm(tile)
if g.wood >= 20 then
tile.process = true
tile.build = grass.farm2
tile.life = 2
newmessage("Tilling land...")
else
newmessage("20 Wood is needed to make a crop field.")
end
end

function grass.farm2(tile)
g.wood = g.wood - 20
g.maxcrops = g.maxcrops + 16
newmessage("-20 Wood\nLand has been tilled.")
set_properties(tile,farmland.properties)
end

function grass.forest(tile)
if g.seeds >= 4 then
tile.build = grass.forest2
tile.process = true
g.seeds = g.seeds - 4
newmessage("-4 Seeds\nForest Growing...")
else
newmessage("Four seeds is needed to grow a forest.")
end
end

function grass.forest2(tile)
set_properties(tile,forest.properties)
end

function grass.hut(tile)
local pop_req = tile_count("Hut") + 4
if g.wood >= 35
and g.ore >= 20
and g.pop >= pop_req then
g.wood = g.wood - 35
g.ore = g.ore - 20

tile.process = true
tile.build = grass.hut2

newmessage("-35 Wood\n-20 Ore\nConstructing hut...")
else

newmessage("You need 35 wood, 20 ore, and "..pop_req.." people to create a hut.")
end
end

function grass.hut2(tile)
set_properties(tile,hut.properties)
newmessage("Hut has been built.")
end

function grass.rest(tile)
if g.wood >= 80
and g.ore >= 50 then
tile.process = true
tile.build = grass.rest2
newmessage("-80 Wood\n-30 Ore\nBuilding Restaurant...")
else
newmessage("You need 80 wood and 30 ore to build a restaurant.")
end
end

function grass.rest2(tile)
set_properties(tile,rest.properties)
newmessage("Your restaurant has been built. Now start cooking.")
end

grass.menu = {
{"Build Village",grass.village},
{"Make Farmland",grass.farm},
{"Grow Forest",grass.forest},
{"Build Hut",invalid_option},
{"Build Restaraunt",grass.rest}
}

grass.properties = {
name = "Grass",
img = grass.img,
life = 3,
menu = grass.menu}
--


--Forest--
forest = {}

forest.img = getImg("forest.png")

function forest.cut(tile)
if tile.process == false then
tile.process = true
tile.build = forest.explore
newmessage("Cutting down forest...")
end
end

function forest.explore(tile)
local coord = {
{x = 1, y = 0},
{x = -1, y = 0},
{x = 0, y = 1},
{x = 0, y = -1}
}

for i,c in pairs(coord) do
addtile((tile.x + c.x),(tile.y + c.y),forest.properties)
local randomtile = math.random(1,8)
if randomtile == 1 then
set_properties(tile,mine.properties)
elseif randomtile == 2 then
set_properties(tile,lake.properties)
else
set_properties(tile,grass.properties)
end
end
local num1 = math.random(3,6)
local num2 = math.random(3,6)
g.wood = g.wood + num1
g.seeds = g.seeds + num2
newmessage("+"..num1.." Wood\n+"..num2.." Seeds")

sort()
end

forest.menu = {
{"Cut Down Forest",forest.cut}}

forest.properties = {
name = "Forest",
img = forest.img,
life = 1,
menu = forest.menu}
--


--Mine--
mine = {}

mine.img = getImg("mine.png")

mine.time = 0
function update_minetime(dt)
for i,tile in pairs(tiles) do
if tile.minetime ~= nil then
tile.minetime = tile.minetime -dt
end
end
end

function mine.getore(tile)
if tile.minetime == nil then
tile.minetime = 0
end
if tile.minetime <= 0 then
tile.process = true
tile.build = mine.getore2
newmessage("Mining...")
else
newmessage("You must wait "..math.ceil(tile.minetime).." seconds for the ore to be restored.")
end
end

function mine.getore2(tile)
local num = math.random(5,20)
g.ore = g.ore + num
tile.minetime = 30
tile.life = 3
newmessage("+"..num.." Ore")
end

function mine.destroy(tile)
tile.process = true
tile.build = mine.destroy2
newmessage("Destroying mine...")
end

function mine.destroy2(tile)
set_properties(tile, grass.properties)
newmessage("Mine has been decimated")
end

mine.menu = {
{"Mine",mine.getore},
{"Destroy Mine",mine.destroy}
}

mine.properties = {
name = "Mine",
img = mine.img,
life = 3,
menu = mine.menu}
--


--Village--
village = {}

village.img = getImg("village.png")

village.time = 0
village.rand = math.random(60,120)
function update_pop(dt)
local t = village.time
local rand = village.rand
if t >= rand then
village.time = 0
village.rand = math.random(60,120)
if g.maxpop > 0 then
local diff = g.maxpop - g.pop
local num = math.random(g.pop+1, diff/2)
g.pop = g.pop + num
newmessage(num.." people moved into your civilization.")
end
else
village.time = t + dt
end
end

village.menu = {
{"Upgrade Village",invalid_option},
{"Destroy Village",invalid_option}
}

village.properties = {
name = "Village",
img = village.img,
life = 2,
menu = village.menu}
--


--Farmland--
farmland = {}

farmland.img = getImg("farmland.png")

farmland.menu = {
{"Plant Crops",invalid_option},
{"Remove Farm",invalid_option}
}

farmland.properties = {
name = "Farmland",
img = farmland.img,
life = 1,
menu = farmland.menu}
--


--Lake--
lake = {}

lake.img = getImg("lake.png")

function update_fishtime(dt)
for i,tile in pairs(tiles) do
if tile.fishtime ~= nil then
tile.fishtime = tile.fishtime - dt
end
end
end

function lake.fish(tile)

if tile.fishtime == nil then
tile.fishtime = 0
end

if tile.fishtime <= 0 then
tile.process = true
tile.build = lake.fish2
newmessage("Fishing...")
else
newmessage("You must wait "..math.ceil(tile.fishtime).." seconds for more fish to appear.")
end
end

function lake.fish2(tile)
local num = math.random(0,10)
g.fish = g.fish + num
tile.fishtime = 20
tile.life = 3
newmessage("+"..num.." Fish")
end

lake.menu = {
{"Fish",lake.fish}
}

lake.properties = {
name = "Lake",
img = lake.img,
life = 3,
menu = lake.menu
}
--


--Hut--
hut = {}

hut.img = getImg("hut.png")

hut.time = 0
function update_huts(dt)
if hut.time >= 60 then
local str = ""
for i,a in pairs(tiles) do
for i,b in pairs(tiles) do
if distance(a.x,a.y,b.x,b.y) <= 1 then
if a.prof == "miner"
and b.name == "Mine" then
local num = math.random(5,20)
g.ore = g.ore + num
str = str.."+"..num.." Ore\n"
elseif a.prof == "lumberjack" then
local num = math.random(3,6)
g.wood = g.wood + num
str = str.."+"..num.." Wood"
end
end
end
end
hut.time = 0
newmessage(str)
else
hut.time = hut.time + dt
end
end

function hut.miner(tile)
if tile.prof == nil then
tile.prof = "miner"
end
end

function hut.lumberjack(tile)
if tile.prof == nil then
tile.prof = "lumberjack"
end
end

hut.menu = {
{"Hire Miner",hut.miner},
{"Hire Lumberjack",hut.lumberjack}
}

hut.properties = {
name = "Hut",
img = hut.img,
life = 3,
menu = hut.menu
}
--


--Restaurant--
rest = {}

rest.img = getImg("restaurant.png")

function rest.food(tile)
if g.ore*4 >= g.fish + g.crops then
tile.process = true
tile.build = rest.food2
newmessage("Cooking food...")
else
newmessage("You need "..math.floor(((g.fish + g.crops)/4) - (g.ore)).." ore to cook your food.")
end
end

function rest.food2(tile)
local num1 = g.ore - math.floor((g.fish + g.crops)/4)
g.ore = g.ore - num1

local num2 = g.fish + g.crops
g.food = g.food + num2

newmessage("-"..num1.." Ore\n+"..num2.." Food")

g.fish = 0
g.crops = 0
end

function rest.destroy(tile)

end

rest.feed = 0
function feed_pop(dt)
if g.pop > 0 then
local feed = rest.feed
if feed >= 60 then
if g.food >= g.pop then
newmessage("Your population was successfully fed!")
else
local diff = g.pop - g.food
g.pop = g.pop - diff
newmessage(diff.." people died of hunger.")
end

if not tile_count("Warehouse") >= 1 then
g.food = 0
newmessage("Your food has been thrown away, maybe you should get a warehouse to store it.")
else
newmessage("Your warehouse has stored your unused food.")
end
rest.feed = 0
else
rest.feed = feed+dt
end
end
end

rest.menu = {
{"Make Food",rest.food},
{"Destroy Restraunt",rest.destroy}
}

rest.properties = {
name = "Restaurant",
img = rest.img,
life = 3,
menu = rest.menu
}
--























--RANDOM SPACE LOL