How do I do collision with Tiled ?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
VetruvianSprite
Prole
Posts: 12
Joined: Tue Sep 24, 2013 3:35 am
Location: Pennsylvania

How do I do collision with Tiled ?

Post by VetruvianSprite »

I'm in the process of making a game right now, and I made a map with the Tiled map editor and am using ATL to load it, I got it to display and everything properly but I'm a bit lost as far as how to do collision, can anyone tell me how to go about doing it ? and please if you can, keep in mind i'm not very good yet, thanks. XD


Here is the .love
http://www.filedropper.com/wip

I want to make it so the player collides with the stone tiles.
I love a nice D.R.Y. K.I.S.S.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: How do I do collision with Tiled ?

Post by micha »

Technically there are two parts you have to do: (1) Access the collision information from the map and (2) Do the actual collision stuff.

In which part do you need help?
User avatar
VetruvianSprite
Prole
Posts: 12
Joined: Tue Sep 24, 2013 3:35 am
Location: Pennsylvania

Re: How do I do collision with Tiled ?

Post by VetruvianSprite »

micha wrote:In which part do you need help?
Well honestly, both. :?
I love a nice D.R.Y. K.I.S.S.
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 2:09 am, edited 1 time in total.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: How do I do collision with Tiled ?

Post by micha »

I learned a lot from the tutorial on Exploding Rabbit. It does collision and uses Advanced Tiled Loader, so hopefully exactly what you need.
User avatar
VetruvianSprite
Prole
Posts: 12
Joined: Tue Sep 24, 2013 3:35 am
Location: Pennsylvania

Re: How do I do collision with Tiled ?

Post by VetruvianSprite »

bekey wrote:if you right click on the stone tile in the tilesheet and give it a property called "obstacle" or "solid" or "poophole" and then when you iterate over the tiles on your map inside the code, you can say something like:

Code: Select all

for x, y, tile in map("Layer_Name"):iterate() do
		if tile.properties.obstacle then
                        -- Make it solid, lel
		end
end

Where in the program would I want to put this?
I love a nice D.R.Y. K.I.S.S.
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 2:08 am, edited 1 time in total.
User avatar
ac3raven
Citizen
Posts: 60
Joined: Tue May 19, 2009 1:14 am

Re: How do I do collision with Tiled ?

Post by ac3raven »

Would anyone mind going into a little more detail on how to make obstacle tiles solid, as in the above for loop?
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest