Hi there, I have a question about relative placement of sprites using the anchor behavior.
I think that there are 2 ways to relatively align objects to the viewport of a game:
1. The Anchor Behavior
2. Manually placing the sprites X & Y positions by using the Viewport Expressions. [eg. ViewportLeft("Layer") + ViewportRight("Layer")) / 2 , to center X]
However, if we for example plan to create a simple game menu with a sprite in the center and use the anchor behavior to do that, wouldn't that be inefficient
compared to manually placing the sprites X position with the viewport expressions at the start of a layout?
I mean when using the 2nd method you essentially just trigger it once with only one impact on performance on the start of the layout.
Just to make it clear, I think that the anchor behavior is always setting the position of a sprite.
Meaning after the sprite had been placed in the correct position in the first time, would it still run and try to set the sprites position even if it has the same value as before?
For example if we would try to place the relative X position of a sprite, would the behavior work like the following:
IF: Sprite.X is still at the same place ~> DO: Nothing (No further performance impact.)
ELSE DO: Set the new position and relatively place Sprite.X[/code:8jwxgv2g] OR does the behavior work like this:
[code:8jwxgv2g]ALWAYS [Every Tick]: Determine the new position and relatively place Sprite.X (Constant impact on performance.)[/code:8jwxgv2g]
I know that this might be confusing but it is really difficult for me to explain this process
because I don't know/understand what goes on behind the scenes, in the actual JS code.
([i]I guess this question is for people with experience in coding with JS?[/i])