Loading the game level
Advanced Tiled Loader is an open source script (concept), and can be found on GitHub at https://github.com/Kadoba/Advanced-Tiled-Loader. Download it, decompress it, and put the Advanced-Tiled-Loader-master
folder in the source directory of your game. Then create a maps
directory and place your exported .tmx
file (tile map file) and the tile sprite image (we want to assume you designed your game level from this directory, else your game might return some errors) in it. So the script to load our tile map is as follows:
--platformer with TILED local loader = require ("Advanced-Tiled-Loader-master/Loader") ---the path to our .tmx files and sprites loader.path = "maps/" function love.load() love.graphics.setBackgroundColor(225, 153, 0) -- load the level and bind the variable map map = loader.load("tilemap.tmx") end function love.draw() map:draw() end
That's it. Now you can run your game and see; it's that simple. You should see your level design display...