Page 1 of 1

How can i make a polygon physical shape with sti and Tiled?

Posted: Wed Oct 11, 2023 5:42 pm
by Yani354
I want to make a box2d polygon shape with Tiled/sti, but i don't know how to do it.
Could someone explain?

demo:
game.love
(21 KiB) Downloaded 55 times

Re: How can i make a polygon physical shape with sti and Tiled?

Posted: Wed Oct 11, 2023 7:07 pm
by darkfrei
Yani354 wrote: Wed Oct 11, 2023 5:42 pm I want to make a box2d polygon shape with Tiled/sti, but i don't know how to do it.
Could someone explain?

demo:
game.love
Like this?
viewtopic.php?p=218447#p218447

Also:
Challacade wrote:In Tiled, you can go to View -> Snapping to turn off grid snapping, so you can set things at the individual pixel level. Then for polygons, you can draw polygons on the object layer, there's a dedicated tool for that. www.youtube.com/watch?v=IHmF_bRpOAE

Re: How can i make a polygon physical shape with sti and Tiled?

Posted: Thu Oct 12, 2023 10:02 am
by Yani354
darkfrei wrote: Wed Oct 11, 2023 7:07 pm
Yani354 wrote: Wed Oct 11, 2023 5:42 pm I want to make a box2d polygon shape with Tiled/sti, but i don't know how to do it.
Could someone explain?

demo:
game.love
Like this?
viewtopic.php?p=218447#p218447

Also:
Challacade wrote:In Tiled, you can go to View -> Snapping to turn off grid snapping, so you can set things at the individual pixel level. Then for polygons, you can draw polygons on the object layer, there's a dedicated tool for that. www.youtube.com/watch?v=IHmF_bRpOAE
I meant is it possible rather than a rectangular shape to be an a polygon shape

Code: Select all

physics.shape = love.physics.newRectangleShape(width, height --area.lua line 15)
which you create through tiled

Code: Select all

function Map:spawnEntities() -- map.lua line 20
	for k, v in ipairs(Map.level.layers.entity.objects) do
		if v.type == "area" then
			Area:new(v.x + v.width / 2, v.y + v.height / 2,v.width,v.height)
		end
	end
end
i know that i should use this: https://love2d.org/wiki/love.physics.newPolygonShape
but i don't know how to implemented.

Re: How can i make a polygon physical shape with sti and Tiled?

Posted: Thu Oct 12, 2023 10:38 am
by darkfrei
Also I've tried to make polygons for tiled world: viewtopic.php?p=255788#p255788
Image

Re: How can i make a polygon physical shape with sti and Tiled?

Posted: Thu Oct 12, 2023 10:51 am
by Yani354
darkfrei wrote: Thu Oct 12, 2023 10:38 am Also I've tried to make polygons for tiled world: viewtopic.php?p=255788#p255788
Image
i am asking is it possible to create a polygon with the program "Tiled" and to create it as a physical object with sti and box2d

everything i am trying to do is on the game.love
game.love
(21 KiB) Downloaded 37 times