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.9.8

Post by Karai17 »

In Tiled, go to File -> Export and select "Lua".
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
darm88
Prole
Posts: 11
Joined: Thu Jun 21, 2012 10:16 pm

Re: Simple Tiled Implementation - STI v0.9.8

Post by darm88 »

Awesome, I figured it out last night before going to bed. Didn't realize I could do that before. This is a pretty cool library.
darm88
Prole
Posts: 11
Joined: Thu Jun 21, 2012 10:16 pm

Re: Simple Tiled Implementation - STI v0.9.8

Post by darm88 »

Do you guys still use AnAl for the spritesheet of characters with this library
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.8

Post by Karai17 »

I've never used a third party library for animations in STI.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Elemental
Prole
Posts: 5
Joined: Tue May 19, 2015 2:13 am

Re: Simple Tiled Implementation - STI v0.9.8

Post by Elemental »

So I just starting working with love and lua, and I feel it is needed to be said that I was able to load up tiled, create a map with a few sprites and create a nice 2d "game". This only took like an hour of my time, which I thought was excellent. Hence I feel props are in order. I am however having some problems expanding upon this, as all I currently have right now is a small map, some walls, a floor, with a ball that can float around and successfully collide into and get stopped by the walls and floor.

The problem comes when trying to add scrolling, I saw in the example on github, to set the players x/y to the transformX and transformY for the setDrawRange function, so I used the ball's getX and getY for this, however when the ball goes past the screen's width on the right all that is displayed is a black screen.

Any thoughts?
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.8

Post by Karai17 »

The draw range is supposed to be the translate x,y and the window's w/h. This tells sti where to begin drawing and where to end. You probably don't want to use the ball's position for your draw range, at least not directly. You want to add the ball to a custom layer in the map and then move the camera (translating) so that the map is always drawn.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Elemental
Prole
Posts: 5
Joined: Tue May 19, 2015 2:13 am

Re: Simple Tiled Implementation - STI v0.9.8

Post by Elemental »

Hmm, so I think I'm having a little trouble figuring out how to implement what you are saying with the sti library. As I do not see anything that indicates a camera, additionally it did make sense to me that translate X and translate Y did come from the players x and y coords, but if not directly from the players x and y then, I'm not sure how these would be used. I think I might not be to sure on the definition of translate in this context.

Additionally as following the example on github, https://github.com/karai17/Simple-Tiled-Implementation, I created a spriteLayer and set that to map.layers["sprite Layer"], however the sprite doesn't seem to be drawn. I added some print statements to the spriteLayer:draw and update function and no print statements were being printed to the console. I was able to get the sprite to be drawn after removing local from the spriteLayer then within love.draw calling spritelayer:draw(). So it seems like I am missing some step when trying to create a custom layer.

Lastly I've messed around with different values for the draw range, and it seems like I am getting some strange results. I noticed that the black screen shows up when translateX is greater than windowWidth, but when I change windowWidths value from say 800 to 300, screen size as well as what is being draw seem to be exactly the same.

I wonder if I'm using the correct version of the sti library, I pull this code directly from the master branch on the github repo https://github.com/karai17/Simple-Tiled-Implementation.

Additionally thanks for the help.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.9.8

Post by Karai17 »

You should check out the demo linked in the OP, it has a lot of code I think you could use.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Elemental
Prole
Posts: 5
Joined: Tue May 19, 2015 2:13 am

Re: Simple Tiled Implementation - STI v0.9.8

Post by Elemental »

Hmm, this is pretty interesting and the code on the first post, Orthogonal.love's main.lua did help a lot. At first I wasn't to sure what to do with a .love, but open it with a zip tool and look at that a bunch of source files, kinda makes me wonder if there is anyway to keep those hidden from end users.


Either way I might have found something interesting. I have copied the exact code from the main.lua in the Orthogonal.love demo so that everything should be the exact same, yet I get some strange behavior. So it seems that when I put in the map.lua in the Orthogonal.love demo you originally posted, my sprite was able to show up, however when using the map I generated with the tiled .12 version I installed the individual tiles were showing up and were able to have proper collision boxes, yet strangely the main sprite would not show up. Adding print statements to the spriteLayers:update and draw function show that these functions are not being called when using the level I generated.

I don't know to much about lua, but maybe some error is occurring and is being caught, then not showing/indicating that an error occurred?

I noticed a few of the previous posts referring to tiled .11 or .10 so I'm going to download and install tiled .11 and see if the same issue still occurs.

Thanks again.
Elemental
Prole
Posts: 5
Joined: Tue May 19, 2015 2:13 am

Re: Simple Tiled Implementation - STI v0.9.8

Post by Elemental »

Okay I've just something even more interesting, but first, so it seems that changing the version of tiled did not affect whether the sprite layer was drawn or not. This is still using the map tiled file provided in the Orthogonal.love file on the first post and using tiled version 0.12.0 . After removing all the layers except for one layer, which was the Ground layer. The sprite then stopped being rendered and updated, so it seems like there is something with the amount of layers? Either way odd that the layers affect how is being drawn or not.

Additionally oddly when I deleted the Ground layer, then re exported the game, running the game gave this error.

STI/map.lua:175: bad argument #1 to 'ipairs' (table expected, got nil)

Traceback

[C]: in function 'ipairs'
STI/map.lua:175: in function 'initWorldCollision'
main.lua:16: in function 'load'
[C]: in function 'xpcall'

Again this is all using the Orthogonal.love files, but just changing the map that is being used.
Post Reply

Who is online

Users browsing this forum: No registered users and 149 guests