I'm new to LÖVE and Lua world, but I made a little library that could help with tilemap loading. For prototyping, I've already been frustrated of editing my map directly from from array of ids or chars : I find it difficult to imagine the final look of the map.
Version 1.1.0
That's why I've developped this little library that "translates" pixel color value to tiles.
So basically you register your colors, and then the library loads your tiles coordinates from pixel information. It is also possible to precise groups for tiles, and all adjacent tiles with same group will generate rectangles (for collision purposes for example).
Code: Select all
local pixelmap = require('pixelmap')
pixelmap.register(0) -- Default tile
pixelmap.register(1, "#86a36bff", { "Ground" })
pixelmap.register(2, "#a47550ff", { "Ground" })
pixelmap.register(3, "#6e5a4aff")
local map = pixelmap.load('map.png')
--[[
{
tiles= {
{0,0,0,0,0,0}
{0,0,1,1,0,3}
{0,0,2,2,0,3}
},
groups = {
"Ground" = { { x=3,y=2,w=2,h=2} }
}
}]]
Obviously a "real" map editor is far better, but a lot of work too : this library is intended to speed up my prototyping phases. I've almost no experience with lua and LÔVE so don't hesitate to give me some suggestions to improve the code quality !
The library is available here : https://github.com/aloisdeniel/love-pixelmap
Version 1.0.0
I've also developed a texture atlas loader from pixel information. It basically cut your image into quads from a predefined pixel color separator.
Code: Select all
local pixelatlas = require('pixelatlas')
pixelatlas.register("#86a36bff")
local image, quads = pixelatlas.load('atlas.png')
--[[
{
<quad 1x1x16x16>,
<quad 17x1x16x32>,
...
}]]