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

Post by Karai17 »

The case of the haunted TMX file!

And yes, if you set an object's properties (collidable:true, sensor:true), then it will create a "hollow" collision (you won't bounce off of the box). This allows you to execute a callback.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Jimlarck
Prole
Posts: 14
Joined: Wed Sep 14, 2016 10:30 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Jimlarck »

Karai17 wrote:The case of the haunted TMX file!

And yes, if you set an object's properties (collidable:true, sensor:true), then it will create a "hollow" collision (you won't bounce off of the box). This allows you to execute a callback.
Does STI check for sensor:true? Do you have any code examples?
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Karai17 »

Yes it does (it's in the docs). I don't have any examples unfortunately. I'm not terribly familiar with box2d. Maybe you could come and hang out in the #love IRC channel and see if someone there knows more?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Jimlarck
Prole
Posts: 14
Joined: Wed Sep 14, 2016 10:30 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Jimlarck »

Karai17 wrote:Yes it does (it's in the docs). I don't have any examples unfortunately. I'm not terribly familiar with box2d. Maybe you could come and hang out in the #love IRC channel and see if someone there knows more?
Alright cool I'll check it out!
User avatar
AlexCalv
Prole
Posts: 49
Joined: Fri Aug 08, 2014 7:12 pm
Contact:

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by AlexCalv »

I'm having a tough time understanding how to implement STI into my game. I'm making a tower defense game and what I have setup are rectangle objects in areas that towers CAN be placed on, and I have a polygon shape object created to specify the path that I wanted enemies to take.
I have no idea how I can call to the objects and check to see if I can place one of my towers onto the object or not. And I would also like to know if I can use the object shapes and make something follow the line. I really have no idea if I'm using Tiled correctly either lol.

Here's my project file: Link
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Karai17 »

Each object has a properties table you can access, so you can give an object properties such as flags to let your program know what can be built there.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
AlexCalv
Prole
Posts: 49
Joined: Fri Aug 08, 2014 7:12 pm
Contact:

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by AlexCalv »

Karai17 wrote:Each object has a properties table you can access, so you can give an object properties such as flags to let your program know what can be built there.
Right, I understand I need to do that. But I don't understand your documentation because of lack of examples.

Code: Select all

function tower.PlaceAtMouse(x, y)
	for i,v in pairs(map.objects) do
		getPlayableAreaProperties()
		if v.canPlace== true then
			tower.Spawn(mouseX - 16, mouseY - 16, tower.selected)
			printDevMsg("SPAWNED " .. string.upper(tower.selected) .. " AT: " .. mouseX - 16 .. ", " .. mouseY - 16)
		end
	end
end

function getPlayableAreaProperties()
	for i,v in pairs(map.objects) do
		if v.name == "playable_area" then
			map:getObjectProperties("towerAreas", "playable_area")
		end
	end
end
I honestly don't understand how to incorporate STI into my game.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Karai17 »

So you want to mouse over an STI object to determine what kind of units can be placed there?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
AlexCalv
Prole
Posts: 49
Joined: Fri Aug 08, 2014 7:12 pm
Contact:

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by AlexCalv »

Karai17 wrote:So you want to mouse over an STI object to determine what kind of units can be placed there?
Correct. I also wanted to know if I can use a polygon shape as like a "rail" for my enemies to follow. Or if I have to use a pathfinding algorithm.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Karai17 »

I would recommend using an axis-aligned bounding box (a rectangle with 0 rotation) and do an AABB check on the object to see if your mouse pointer is "colliding" with the box.

As for rails, I would recommend checking out Jumper, an A* path finding library. I'm sure you could use a rail, but I've never tried.
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: Ahrefs [Bot] and 212 guests