1

I have exported my Game world (Tiles + Collision Tiles) from Tiled as a Lua File, How do i integrate this into my Love2d Game and Determine which one is a Walkable path and Which one is not?

M.Hussaini
  • 135
  • 1
  • 5
  • 15
  • I wouldn't consider this a proper answer but if you'd like to see how someone else did this you can check out my implementation: https://github.com/TannerRogalsky/big_trouble/blob/map_prototypes/map_loader.lua It's not meant to be useful to everyone but it might save you some time in your own implementation. – WuTangTan Oct 27 '13 at 12:44

1 Answers1

2

If you look in this question (What code do I wrap around Lua code in C++ with LuaBind?) you will find an example of what the lua file looks like. All it is is a file that when run in lua will return a dictionary containing all the data about your game world.

Assuming your map is called "mymap.lua" you would do this in one of the following ways:

require("mymap")
local mymap = love.filesystem.load("mymap.lua")()

Then, to use it, you would do something like:

-- loads the sprites of the first tileset
local tileset1 = love.graphics.newImage(mymap.tilesets[1].image)

-- print the width and height of the first layer
print(mymap.layers[1].width, mymap.layers[1].height)

As for what each piece of the imported data means, you will have to work it out yourself.

Community
  • 1
  • 1
kazagistar
  • 1,537
  • 8
  • 20
  • Sorry, but you are going to have to be more specific then "resources", "assignment". Do you need help understanding path finding? Lua? Love2d? File formats? – kazagistar Oct 20 '13 at 00:56