Add conceptual anchor points to all classes which exist in the 2D space, and have them be extendable in subclasses.
You should be able to set and get anchor points, such that the following is possible:
val rect = RectSdf(
width = 100
height = 30
)
val text = Text()
// The MyCustomPlayer class is an imaginary user defined class which sets its
// gun position based on player aim and player character behavior. This is added
// as an anchor point to the class.
val player = MyCustomPlayer(
health = 10
radius = 22.3
)
def loop(): Unit =
// player has already been updated at this point...
// Have the rect's bottom left corner be moved onto the gun position with an offset added to it
rect.anchor.bottomLeft = player.anchor.gunPos + Vector2(10,10)
// Display the ammo count and move the text
text.content = s"${player.ammo}/${player.maxAmmo}"
text.anchor.center = rect.anchor.center
Add conceptual anchor points to all classes which exist in the 2D space, and have them be extendable in subclasses.
You should be able to set and get anchor points, such that the following is possible:
Some global anchors to consider: