Add KeepInBoundsComponent #842
Labels
difficulty:easy
Simple, few changes required
help wanted
Contributions welcome / high PR acceptance rate
lang:java-or-kotlin
Can be done in Java or Kotlin
This is similar to
KeepOnScreenComponent
incom.almasb.fxgl.dsl.components
, but the user provides aRectangle2D
(which can also be set at runtime). The component does not allow the attached entity to move outside of the bounds. BBox should be used to check entity bounds.Once the above is complete,
KeepOnScreenComponent
should be updated to either extend KeepInBounds or somehow make use of it to avoid code duplication and fix a bug that will occur when viewport is zoomed. In order to fix the bug,viewport.visibleArea
should be used, as it correctly computes visible Rectangle2D.The text was updated successfully, but these errors were encountered: