-
Notifications
You must be signed in to change notification settings - Fork 0
Loader
The Loader module loads a Tiled map (.tmx) with Loader.load() and returns a Map object. You do not need to create an instance of it with new(). It does have some settings you might want to change but otherwise using it is very straightforward.
Example:
local Loader= require "Tidal.Loader"
local map = Loader.load("map.tmx")
Loader.filterMin (default: "linear"
)
The min filter to apply
to tileset images when they are loaded. Can be set to "nearest"
or
"linear"
.
Loader.filterMag (default: "nearest"
)
The magnify filter to
apply to tileset images when they are loaded. Can be set to "nearest"
or "linear"
.
###Functions
Loader.load (tmx_file, chunk_size
)
Import a tmx file and return a Map object.
chunk_size
is an optional number argument; if one is specified,
return a proxy object instead. The proxy allows for asynchronous
loading, which may be useful for large maps. The larger the chunk_size
,
the quicker the map will be loaded on each proxy:update
.
proxy = Loader.load('map.tmx', 10)
-- Set callbacks on load or error
proxy:onLoad(function(new_map)
map = new_map
end)
proxy:onError(function(err)
error(err)
end)
function love.update(dt)
proxy:update()
end
function love.draw()
if map then map:draw() end
end