Thanks a lot. That helps. There are so many ways to do things in this program I never know what to do. It would be nice if someone made a tutorial on various movements and explained why to use one over the other. It's all fairly confusing to me.
I can only recommend to read the manual. It's really worth to read, most of the questions are answered there.
So help me understand this...
For the viewport borders you are comparing the player's positions. "If X > ViewportRight(0)-PLAYER.Width/2-1" tells this event if the player gets within 1 pixel of touching the right side of the viewport to set the 8 direction vector X to 0 correct? I watched this in debug and it helped me understand it better. This is based off the player origin point right?
This is exactly what it does. The player origin is a very crucial for this. If you have an animation where the origin is on different positions, you get a bug that is very hard to track down. If you use this kind of condition.
ViewportRight(0) - I think I see what this is doing. So Viewport[direction](X) tells it to take the position from the viewport edge in the direction specified (X) pixels from that edge?
Not exactly. The x is only the layer of the viewport. If you have different layers you can change with 'Parallax' in the Layer-Properties the scroll speed. So the viewport can be on different position on different layers. I could have used Vieport("BG") instead of Viewport(0), it's the same.
The viewport itself is only a window of the layout what you see. You can scroll the viewport around in the bounding of the layout. The size of the viewport is the size of 'Window Size' in the 'Project-Settings'. In your example if you use the 'Test_Layout' the Layout and the viewport has the same size: 1920x1080. So in this case there is no scrolling. All Layer have the same viewport position. ViewportLeft(0) is X=0, ViewportRight(0) is X=1920, ViewportTop(0) is Y=0, ViewportBottom(0) is Y=1080. But the position of the Viewport depends of the scrolling in the layout, so the Viewport values are NOT always 0 and the window.height / width.
Another crucial point is that the origin of the coordinates are top left. Maybe that will help to understand the vector X and Y a little bit better. I set the Vector X or Y to zero if you are on the border of the Viewport and you have the velocity to this border, otherwise you couldn't fly in the opposite direction. The velocity would always be 0 if you are near the boundary. So if you the gravity drag the object down you get a positive vector y, because of the coordinates.
My example should also work if you scroll in a bigger layout, because with the 'ScrollTo-Behavior' the object is always in the center of the viewport. The exception is when you got to the boundary of the layout, then the object should move to boundary of the viewport.
My english is not the best, I hope that makes all at least some sense to you.
Please ask if something isn't understandable.