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.
Simple Tiled Implementation - STI v1.2.3.0
Re: Simple Tiled Implementation - STI v0.16.0.3
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
Does STI check for sensor:true? Do you have any code examples?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.
Re: Simple Tiled Implementation - STI v0.16.0.3
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é
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
Alright cool I'll check it out!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?
Re: Simple Tiled Implementation - STI v0.16.0.3
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
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
Re: Simple Tiled Implementation - STI v0.16.0.3
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é
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
Right, I understand I need to do that. But I don't understand your documentation because of lack of examples.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.
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
Re: Simple Tiled Implementation - STI v0.16.0.3
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é
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.16.0.3
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.Karai17 wrote:So you want to mouse over an STI object to determine what kind of units can be placed there?
Re: Simple Tiled Implementation - STI v0.16.0.3
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.
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é
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Who is online
Users browsing this forum: Google [Bot] and 2 guests