hexus / phaser-arcade-slopes

:triangular_ruler: A Phaser CE plugin that brings sloped tile collision handling to the Arcade Physics engine
MIT License
127 stars 16 forks source link

Tile collision direction flags #27

Closed kevin-chau closed 7 years ago

kevin-chau commented 7 years ago

Hi Hexus,

I'm really enjoying you're slopes plugin, its exactly what I needed for my game.

I'm trying to implement jumping through a platform from underneath. I believe normally for a tilemap you can just set the parameter collideDown to false for each tile. Since your plugin uses tilemaps, I've tried doing this but still get collisions from below so I can't jump through. Is there a specific way to turn off down collisions for your slopes plugin or am I doing something wrong? Thanks!

hexus commented 7 years ago

Awesome, I'm glad it's helpful for you.

Actually, the plugin doesn't properly support this yet and probably should in some way.

I'll add this to the roadmap for v0.2.0. It's a compatibility feature I initially left out because the meaning of these directions changes a little once you introduce 45 degree angles. I'm sure I can work something out though, and this will be useful in my own games too.

kevin-chau commented 7 years ago

Are there any work-arounds I can try in the meantime? I wouldn't mind hacking around your plugin a little, but I'm still not sure how to go about one way collisions with it.

hexus commented 7 years ago

Hopefully I'm right in thinking that all it will take is changing these lines:

https://github.com/hexus/phaser-arcade-slopes/blob/v0.2.0-alpha2/src/ArcadeSlopes/SatSolver.js#L611-L626

For example, this part of a condition:

tile.slope.edges.top === Phaser.Plugin.ArcadeSlopes.TileSlope.EMPTY && ...

becomes:

(!tile.collideUp || tile.slope.edges.top === Phaser.Plugin.ArcadeSlopes.TileSlope.EMPTY) && ...

The same would need to be done for bottom, left, right, etc.

I'd probably do this more formally for the actual implementation.

kevin-chau commented 7 years ago

@hexus Just confirmed that what you suggested works for me! Thank you for your help!

hexus commented 7 years ago

Awesome.

Your Mario project looks cool too, I'm glad the plugin helps you to build it.

hexus commented 7 years ago

Fixed above. Thanks for bringing this up. :+1: