Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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. :x

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!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
martov
Prole
Posts: 12
Joined: Thu May 22, 2014 10:55 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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? :roll:
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post by Karai17 »

Make sure the layer name is tin the right casing.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
martov
Prole
Posts: 12
Joined: Thu May 22, 2014 10:55 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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? :?
Attachments
a.love
(964.01 KiB) Downloaded 170 times
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
martov
Prole
Posts: 12
Joined: Thu May 22, 2014 10:55 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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 :P

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? :death:
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Simple Tiled Implementation - STI v0.7.4

Post 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
martov
Prole
Posts: 12
Joined: Thu May 22, 2014 10:55 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post by martov »

yeah I thought so.

thanks c:
TheLivingTree
Prole
Posts: 5
Joined: Thu Jul 24, 2014 12:06 am

Re: Simple Tiled Implementation - STI v0.7.4

Post 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!
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.7.4

Post 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]
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

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