cocoatoucher / Glide

Game engine for making 2d games on iOS, macOS and tvOS, with practical examples and tutorials
MIT License
493 stars 43 forks source link

Fix finish checkpoint height #9

Closed vikgor closed 1 year ago

vikgor commented 1 year ago

For finish checkpoints, as for all checkpoints, the height of the collider component was always set to (screenSize - leftBottomCorner), meaning finish checkpoints were always "stretched" to the top.

That limited the options for level design, because putting a finish checkpoint in the bottom of the level would mean that the same X position on other levels higher than the actual finish checkpoint would count as such (meaning you couldn't walk just above the checkpoint).

To fix that I added a isFinish parameter which would set CheckpointComponent.adjustsColliderSize to false to keep the original height of the collider. Also updated RestartAtCheckpointScene to showcase the setting.

Before After
before after
cocoatoucher commented 1 year ago

Hello, thanks for the contribution and the detailed explanation and sorry for the delay on my side. I'm thinking maybe instead of naming this variable isFinished, it can be named something like stretchesToTop to make it ready for more general use. What do you think?

vikgor commented 1 year ago

Sure, makes sense Let me update the changes Thanks for the reply!

vikgor commented 1 year ago

I can't merge this PR, if it's ok you can do it any time Thank you! The engine is great, I'm working on a simple game, hoping to release it next month, will make sure to let you know.