Page 20 of 27

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Tue Oct 23, 2012 12:27 am
by Kadoba
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.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Thu Nov 01, 2012 10:45 pm
by Uhfgood
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!

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Thu Nov 01, 2012 11:54 pm
by Kadoba
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

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Fri Nov 02, 2012 1:49 am
by Karai17
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.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Fri Nov 02, 2012 2:26 am
by Kadoba
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.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Thu Jan 03, 2013 8:16 pm
by danbo
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.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Sun Jan 06, 2013 4:56 pm
by Karai17
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)

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Mon Jan 07, 2013 9:41 am
by Ubermann
I got a "Unknown event q" when I press [ESCAPE]

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

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Tue Jan 08, 2013 2:36 pm
by Kadoba
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.

Re: Advanced Tiled Loader - Updated to 0.12.0!

Posted: Fri Jan 18, 2013 8:26 pm
by Uhfgood
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?