Hey, that's something cool!
Here's some tips:
Code: Select all
function setgamestate(state)
if state == "mainmenu" then
mainmenu.load()
elseif state == "overworld" then
overworld.load()
end
gamestate = state
end
This is gonna get repetitive if you add more gamestates. I think you should do:
Code: Select all
function setgamestate(state,...)
if _G[state] then
_G[state].load(...)
end
gamestate = state
end
(And then you should also change the other callbacks in main.lua)
That way you can add more gamestates easily.
Also note how I added an "..." parameter in the function. "..." is the remainder of the arguments. That way you could call setgamestate("overworld","map123.txt") and overworld.load will get "map123.txt" as a parameter.
---
Code: Select all
font = love.graphics.newImage("graphics/font.png")
fontchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.!?,' "
fontquads = {}
for x = 1, string.len(fontchars) do
fontquads[string.sub(fontchars, x, x)] = love.graphics.newQuad(7*(x-1), 0, 7, 8, font:getWidth(), 8)
end
You should use love.graphics.newImageFont, Imo. Sure, you have to change the font to adapt it to the newImageFont format, but it's worth it: you can use love.graphics.print() and love.graphics.printf() (which is better than your printp function, since your might cut the words in half) directly, it's faster(Because l.g.print is optimized), and it take less code.
Fyi, a font formatted for l.g.newImageFont look like this :
---
textbox.lua :
Code: Select all
--border
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", (self.x+8)*scale, (self.y+2)*scale, (self.width-8)*scale, scale)
love.graphics.rectangle("fill", (self.x+8)*scale, (self.y+4)*scale, (self.width-8)*scale, 2*scale)
love.graphics.rectangle("fill", (self.x+8)*scale, ((self.y+self.height)-6)*scale, (self.width-8)*scale, scale)
love.graphics.rectangle("fill", (self.x+8)*scale, ((self.y+self.height)-4)*scale, (self.width-8)*scale, 2*scale)
love.graphics.rectangle("fill", (self.x+2)*scale, (self.y+8)*scale, scale, (self.height-8)*scale)
love.graphics.rectangle("fill", (self.x+4)*scale, (self.y+8)*scale, scale, (self.height-8)*scale)
love.graphics.rectangle("fill", ((self.x+self.width)-4)*scale, (self.y+8)*scale, scale, (self.height-8)*scale)
love.graphics.rectangle("fill", ((self.x+self.width)-6)*scale, (self.y+8)*scale, scale, (self.height-8)*scale)
You might want draw the borders using an image. That way, they will be customizable.
---
You could save and load the maps using JSON. That way, you don't have to create your own format.
---
Here's the source of Stabbymon :
https://www.dropbox.com/s/xkf7pacc8x5eu ... n-last.zip
I hope it will be useful. Note about menusystem.lua : With it, you can make complex menus like the "select pokemon menu". It don't do the drawing part, though.
Also, when you will do the pokemon system, since your goal is to permit anyone to create their own pokemon adventure, I think creating pokemon should be as easy as possible. Like, you shouldn't even touch code.