Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by bobbyjones »

Karai17 wrote:You need to use math.floor to make sure you are translating and drawing to an internet value.
Integer value I think you mean.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by Karai17 »

Mobile phones tho
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
rod_sn
Prole
Posts: 27
Joined: Sun Jan 11, 2015 9:59 am

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by rod_sn »

quick question, how can i, for example, make a door, or other interactive object on the map? Or how can i change the tile image for a tile that was inserted on an object layer? ty :3

edit: actually is there any way i can even update the proprieties of the layer/object layer?
"You certainly usually find something, if you look, but it is not always quite the something you were after."
-Thorin Oakenshield, J.R.R. Tolkien
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by Karai17 »

If you use the Box2D plugin, you can create a sensor object that performs some action when you collide with it. Set the properties collidable = true and sensor = true. If you use a different plugin, or your own collision code, you can code that in manually.

You can swap out a tile using Map:swapTile(current_tile_instance, new_tile_object)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
rod_sn
Prole
Posts: 27
Joined: Sun Jan 11, 2015 9:59 am

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by rod_sn »

ok thanks. So i cant change a propriety of a tile while running the program?
Edit: this is because i tried to change it while running, and it wont update... I added the map:update(), so idk why it wont change.
"You certainly usually find something, if you look, but it is not always quite the something you were after."
-Thorin Oakenshield, J.R.R. Tolkien
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by Karai17 »

Yes and no. You can't change the properties of an individual instance of a tile, but you can change the properties of a tile, and all of its instances. Map.tiles[gid].properties is what you're after.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
rod_sn
Prole
Posts: 27
Joined: Sun Jan 11, 2015 9:59 am

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by rod_sn »

but if i have multiple doors, and i only want one to open, i cant use the way you told me now, it would change the properties of all the doors using that tile, no?
"You certainly usually find something, if you look, but it is not always quite the something you were after."
-Thorin Oakenshield, J.R.R. Tolkien
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by Karai17 »

You don't want to use tiles for such things. Use tile objects in Tiled to place individual door objects, and then update them individually in love.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
rod_sn
Prole
Posts: 27
Joined: Sun Jan 11, 2015 9:59 am

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by rod_sn »

update them with Map.tiles[gid].properties?
or with swap? im so confused ;-;
"You certainly usually find something, if you look, but it is not always quite the something you were after."
-Thorin Oakenshield, J.R.R. Tolkien
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.13

Post by Karai17 »

Map:swapTile is used to replace a tile in a layer with a different one. Map.tiles[gid] is a tile object that you can modify so that all tile instances will be updated (exept for the graphic, you need to use swapTile for that since sprite batching acts like a cache).
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: No registered users and 2 guests