Advanced Tiled Loader - No longer maintained

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Kadoba » Tue Oct 23, 2012 12:27 am

Karai17 wrote:A thought. How feasible would it be to use ATL without grid locking? And further on that notion, How feasible would it be to detect collisions with objects without grid locking? For instance, if I have a rock sitting in the middle of a tile, How could I detect only the part of the tile that is not transparent? Would I maybe need semi-complex polygons over top the collision area, or would it be possible to determine if the sprite's opaque pixels are going to collide with the rock's opaque pixels?

I like ATL very much; working with Tiled maps is quite easy and I wouldn't want to lose such a great tool for this thing I am about to start working on.
You can definitely do those things. Just because the rendering is grid-based doesn't mean your game logic has to be. But collision detection is complicated and outside the scope of ATL so I can't help you with the specifics. That is something you have to decide on. For per-pixel stuff you will likely just have to load the tileset image separately and take what information you need from the pixel data.

User avatar
Uhfgood
Prole
Posts: 35
Joined: Sat Jul 28, 2012 10:04 pm
Location: Oregon, US
Contact:

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Uhfgood » Thu Nov 01, 2012 10:45 pm

I've noticed it will draw flipped tiles, however is there a way I can tell if a tile in the tile layer has been flipped?

This kind of functionality is important to me in my current game. Thanks!

User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Kadoba » Thu Nov 01, 2012 11:54 pm

Sort of. There isn't a public interface for it. A single binary value represents the flipped status of a tile and it's stored in TileLater._flippedTiles, which is a grid. The 1's binary digit represents the diagonal flip, the 2's digit represents the vertical flip, and the 4's digit is horizontal.

I'll add a public interface for it soon but in the mean time here is how you can do it yourself:

Code: Select all

local function tileIsFlipped(layer, direction, x, y)
   if direction == "diagonal" then
      return layer._flippedTiles(x,y) % 2 == 1 
   elseif direction == "vertical" then
      return layer._flippedTiles(x,y) % 4 >= 2
   elseif direction == "horizontal" then
      return layer._flippedTiles(x,y) >= 4
   end
end

User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Karai17 » Fri Nov 02, 2012 1:49 am

A thought. How would one go about multi-layering? For instance. Being able to walk under a bridge, but then walk up a flight of stairs so you are now on the same layer as the bridge and able to walk over it.

Image

My first thought would be to make a custom layer between each tile layer and use some property to determine a change-in-layer but that seems like a horrible idea, haha.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Kadoba » Fri Nov 02, 2012 2:26 am

The simplest way would be to use a visual trick instead of layering. Have the bridge be a simple image instead of a tileset and just have a collision box covering each entrance to the bridge (above and below) and depending on the last one hit draw the bridge before or after the player sprite. Or you could just have multiple layers before and after the bridge and switch the player object between them.

User avatar
danbo
Prole
Posts: 18
Joined: Thu Jan 03, 2013 8:11 pm

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by danbo » Thu Jan 03, 2013 8:16 pm

I was having an issue with ATL where what's being rendered would fade out over the course of about 5 seconds, including stuff that ATL doesn't draw (eg. calls to graphics.rectangle).

I don't know what causes it, but I found it only seems to happen if there's just a tile layer in the TMX file. If you add even an empty Object Layer in Tiled, the issue no longer seems to happen.

Just in case anyone else gets the same issue.

User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Karai17 » Sun Jan 06, 2013 4:56 pm

This may be a rounding issue on some systems. if you place the following line after your map:draw(), it should fix the problem:

Code: Select all

love.graphics.setColor(255, 255, 255, 255)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Ubermann » Mon Jan 07, 2013 9:41 am

I got a "Unknown event q" when I press [ESCAPE]

It should be love.event.push("quit").

User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Kadoba » Tue Jan 08, 2013 2:36 pm

Ubermann wrote:I got a "Unknown event q" when I press [ESCAPE]

It should be love.event.push("quit").
Thanks. I swear I have fixed this same bug 5 times now.

User avatar
Uhfgood
Prole
Posts: 35
Joined: Sat Jul 28, 2012 10:04 pm
Location: Oregon, US
Contact:

Re: Advanced Tiled Loader - Updated to 0.12.0!

Post by Uhfgood » Fri Jan 18, 2013 8:26 pm

Is there a way you could implement dynamic map loading?

My slope stuff is using 16x16 sized tiles now, and even though the map itself isn't very big -- It's apparently got too many tiles because it takes seconds to load (like you can actually tell that it's taking the time to load up the whole map).

My game is probably going to have a map even bigger than this test map I made for my sloping code.

The way I would think it would work is if you have load method that takes a chunk size maybe how many tiles in the x and y to load up or where to start and stop... This way I could call this whenever my camera got to the edge of the chunk I previously loaded up. In this way it wouldn't take as much time loading up the whole map at the start.

Also, could you tell me how the tiles are loaded into memory -- that is... are they individual images, or is it like a sprite sheet/ tile sheet? (In other words is a tileset in the loader a table of individual images, or one image that each of the tiles are taken from) -- if this makes any sense?

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests