I have searched around, and for a few days, tried implementing viewports, layer identifiers with mouse coordinates, etc but I noticed something interesting.
I created a scrollable side scroller game layer
I created a UI layer
I set a custom cursor to my mouse specific to the UI layer (i.e. Mouse.X("UI"), etc)
What I found:
The cursor follows mouse flawlessly, even with game layer scrolls, and all parallax etc does the same (because its bound to UI layer)
BUT..having bound to UI, if I leave the mouse/cursor at any position in the game viewport, and then move player, say to the right for example,
The X and Y coordinates of the cursor do not change, even though the cursor moves with the UI layer.
Makes sense, but not sure how to manipulate the X Y values based on game layer while bound to UI.
This is to check if cursor.X is > or < a specific game layer object. I do not know, and have not found yet, how to take the cursor X and offset/add the difference of the left side of the game layer/viewportLeft X coordinate from layout coordinate of beginning at 0 with the viewport.
Does that make sense?
So moving the viewport will obviously side scroll, and of course layout X Y is not supposed to change, so how can I calculate the different between the viewport Left X and the layout 0 OR even UI X since its left is always 0 also?
I could then take cursors Mouse.X("UI") and add the difference so cursor.X is always updated even if viewport moves, so its ALWAYS relative to the actual position in the view. The visuals work fine, but the numbers dont change.