TiledMaps questions for sidescroller

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
noatom
Prole
Posts: 10
Joined: Sun Feb 17, 2013 9:51 pm

TiledMaps questions for sidescroller

Post by noatom »

So I'm planning to make a sidescroller,and obviously,I can't hardcode an entire level,so I need a level editor.I found the leve editor,the only problem is that I can't find a tutorial or something where it shows:

-how to load the map
-how to draw it
-how to create the physics for the objects in that map

For ex,I have to create a rectangle for every tree in the level,how do I do that?
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: TiledMaps questions for sidescroller

Post by Inny »

I'm assuming that you speak of Tiled ( http://www.mapeditor.org/ )

Tiled has an export feature, which will stamp out a .lua file, which you can load the way you load any other lua file (require and love.filesystem.load are the best two). However, Tiled can't load lua files, so save all of your work in the default tmx files before doing the export.

As for how to draw it, it operates on the idea of tilesets, so what you'd need to do is open up a graphics editor (photoshop, The Gimp, etc), and create an image that's something like 256x256 or 512x512. Then draw out your tiles on a grid (which will either be 16x16 or 32x32 in size). Then, Tiled has a menu for adding the tilesets and will let you draw from it onto your map. That does mean that you'll need to draw each tree by hand once (in the tileset), and then you'll need to click it (or it's parts) and put them on the map.

When you want to draw your Map and do collision detection in the game, you're entering a much larger world of code that I can't answer here. However, there are a large number of libraries at https://love2d.org/wiki/Category:Libraries which may be able to steer you in the right direction.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests