Page 19 of 92
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Wed Jul 09, 2014 10:03 pm
by Karai17
animated tiles on the the TODO list for STI. Tiled currently supports animating tiles in nightly builds, but not the official release. I've been lazy in implementing it myself.
I'm currently working on a commercial project right now so I won't have time to poke at STI for a bit. If you're so inclined, you can download a Tiled nightly and see if you can get animations working in STI (though messing around with sprite batches might be less than fun). Otherwise, you might just have to hold off until I get some time to really look into it. Sorry!
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Mon Jul 14, 2014 5:47 am
by martov
Im having some trouble, I cant seem to draw the objects layer using map:draw()
http://s30.postimg.org/xtkn3l68f/Nueva_ ... e_bits.jpg
if I try to use map:drawObjectLayer("Layer name") I get an error
http://s28.postimg.org/wyg6i4lto/Nueva_ ... e_bits.jpg
is this working for everyone else?
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Mon Jul 14, 2014 4:23 pm
by Karai17
Make sure the layer name is tin the right casing.
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Mon Jul 14, 2014 8:31 pm
by martov
it's all correct as far as I can tell, I dont know what else to try. sorry if it's a silly mistake, I just cant seem to find it.
I read the documentation again and again trying to understand what's wrong.
here, I made a very simple example, could you please take a look at it?
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Mon Jul 14, 2014 9:59 pm
by Karai17
Oooh, okay so the problem here is you are passing a string in, not a layer table. This is an oversite in my code and should work. A quick remedy is to put the following at the top of the function before the asser on line 455:
Code: Select all
if type(layer) == "String" then
layer = self.layers[layer]
end
Sorry about that, I'll try to get a fix out soon!
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Wed Jul 16, 2014 11:06 pm
by martov
thank you for taking a look, I could not get it to work with your fix so I just coded a work around the library for the stuff I needed to draw
Im getting another problem, when I try to run my code in a computer with an integrated intel GPU I get an error from STI that says something about the power of 2 syndrome. I thought that it was fixed in love2d 8.0, could it be that STI is somehow vulnerable to PO2?
or maybe it's that the computer may not support canvases?
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Wed Jul 16, 2014 11:17 pm
by slime
On systems which don't support non-power-of-two textures, LÖVE will automatically pad Images but it won't pad Canvases. STI only supports systems with non-power-of-two texture support (personally I've had a computer with that capability since 2005, and it wasn't a top of the line gaming machine either...)
https://github.com/karai17/Simple-Tiled ... /issues/34
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Thu Jul 17, 2014 1:18 am
by martov
yeah I thought so.
thanks c:
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Thu Jul 24, 2014 12:27 am
by TheLivingTree
Hey Karai17, amazing library! Just had one question. I'm a little confused on how to get tile properties to work. I have seen the other questions posted earlier about tile properties but nothing has fixed our issue. Basically all I want to do is iterate through the tiles and sort ones with certain tiled properties.
Here are is the code I have so far
Code: Select all
function findSolidTiles(layer, collider)
local collision_tiles = {}
local half_tiles = {}
local tw = map.tilewidth
local th = map.tileheight
for y=1, map.height do
for x=1, map.width do
local cur_tile = map.tiles[y]
local tx, ty
tx = (x - 1)
ty = (y - 1)
if layer.data[y][x] == 1 then
-- when I try and access the properties is when I run into an issue. They always return nil
print(cur_tile.properties)
local ctile = collider:addRectangle((tx)*16,(ty)*16,16,16) --adds collision to the tile
--down here I plan to assign different colliders depending on the tile
ctile.type = "solid"
collider:addToGroup("tiles", ctile)
collider:setPassive(ctile)
table.insert(collision_tiles, ctile)
else
end
end
end
return collision_tiles
end
Most of this works but accessing the properties does not.
If you could help me out that would be much appreciated! I know this kind of question has been asked before so I apologize if im just overlooking some simple solution. Overall this is a wonderful library thanks for taking the time to code it!
Re: Simple Tiled Implementation - STI v0.7.4
Posted: Thu Jul 24, 2014 4:38 am
by Karai17
your cur_tiles is just a list of tiles, not a specific tile. what you want is map.tiles[y][x]
Alternatively, layer.data[y][x]