kurtome / leap

An opinionated toolkit for creating 2D platformers on top of the Flame engine.
https://pub.dev/packages/leap
MIT License
42 stars 9 forks source link

Add a way to not move some entities that are on top of a moving platform #59

Closed ricardodalarme closed 2 months ago

ricardodalarme commented 2 months ago

I'd like a way to prevent some entities that are on a moving platform from being moved by it.

My current problem is that I have a meteor component that has its position changed when it passes through a moving platform.

I just opened a draft PR to ignore non-solid entities, but that is probably not the best idea

kurtome commented 2 months ago

The problem might be that you want the meteor to behave as a non-solid object with respect to moving platforms (and the ground tiled?). Since by default the MovingPlatform is tagged a ground, you may want to not include ground in the solidTags for your meteor component. You could also make a new movingPlatform tag if you just wanted it to ignore moving platforms but not ground tiles.

Would that work?

In theory https://github.com/kurtome/leap/pull/57 shouldn't be necessary because the component shouldn't only have collisionInfo.down set if it is solid with respect to the moving platform.

p.s. There is a discord channel if you have more questions: https://discord.com/channels/509714518008528896/1166420113692565504

ricardodalarme commented 2 months ago

Oh man! You are absolutely right, the ground tag was exactly what caused this bug. Thank you so much!