Annoraaq / grid-engine

A grid based movement engine compatible with Phaser3.
https://annoraaq.github.io/grid-engine/
Apache License 2.0
241 stars 20 forks source link

Question about "Tiled Editor" and collisions. #492

Closed patrykwegrzyn closed 5 months ago

patrykwegrzyn commented 6 months ago

Hi there,

Thanks for creating this awesome library!

I have a quick question: Do collisions work only with whole tiles, or can we use collision objects from the Tiled Editor as well? I tried to assign ge_collide to collision objects, but I didn't have any luck.

image

Many thanks P

Annoraaq commented 5 months ago

Hey, I don't really know how collision objects work in Tiled, but I think they won't work in Grid Engine.

Grid Engine checks all tiles of the relevant layers for the collision property. Assuming that collision objects are not tile based in Tiled, I would say you could iterate through those, determine which tile positions they block and then set the collision properties of the Tilemap in Phaser. You could add a collision layer for this. Or you could add invisible Grid Engine characters without a sprite on the colliding positions.

Note that collisions in Grid Engine will always be tile based and not pixel based.

patrykwegrzyn commented 5 months ago

Thanks for the quick response, @Annoraaq! I'll stick to the Phaser way of doing it. I just wanted to make sure there isn't a way to handle it with ge.