Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile collision direction flags #27

Closed
kevin-chau opened this issue Feb 8, 2017 · 6 comments
Closed

Tile collision direction flags #27

kevin-chau opened this issue Feb 8, 2017 · 6 comments
Assignees
Milestone

Comments

@kevin-chau
Copy link

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
Copy link
Owner

hexus commented Feb 9, 2017

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.

@hexus hexus added the feature label Feb 9, 2017
@hexus hexus changed the title Turn off down collisions Tile collision direction flags Feb 9, 2017
@hexus hexus added this to the 0.2.0 milestone Feb 9, 2017
@kevin-chau
Copy link
Author

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
Copy link
Owner

hexus commented Feb 9, 2017

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
Copy link
Author

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

@hexus
Copy link
Owner

hexus commented Feb 9, 2017

Awesome.

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

@hexus hexus self-assigned this Feb 9, 2017
hexus added a commit that referenced this issue Feb 9, 2017
Fixed collision snapping running when it shouldn't (#21).
@hexus
Copy link
Owner

hexus commented Feb 9, 2017

Fixed above. Thanks for bringing this up. 👍

@hexus hexus closed this as completed Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants