;   Step 6

    ;   First, time to get a player back.
    ;
    ;       +-------------+
    ;       |             | - Background
    ;       |  (Player)   |
    ;       |     \       |
    ;       |      X-------------+
    ;       |      |      |      | - Screen
    ;       |      |             |
    ;       |      |      |      |
    ;       +------|- - - +      |
    ;              |             |
    ;              |             |
    ;              |             |
    ;              +-------------+
    ;
    ;   This works like our orientation point were it not for
    ;    the relative position of the player :P
    ;
    ;   Okay, as before, the background position on screen is:
    ;
    ;       ( -Back_SizeX / 2 , -Back_SizeY / 2 )
    ;
    ;   So if the player would be in the middle of the background,
    ;    with background orientation, e.g.
    ;
    ;       ( Back_SizeX / 2 , Back_SizeY / 2 )
    ;
    ;   Then the coordinates of the player on screen would be:
    ;
    ;       ( 0 , 0 )
    ;
    ;   Suppose the player doesn't move and stays in the middle.
    ;   Then if you move the background, the player moves with it.
    ;
    ;       +-------------+
    ;       |             | - Background
    ;       |  (Player)   |
    ;       |     \       |
    ;       |      X      |
    ;       |             |
    ;       |             |
    ;       |             |
    ;       +-------------+-------------+
    ;                     |             | - Screen
    ;                     |             |
    ;                     |             |
    ;                     |             |
    ;                     |             |
    ;                     |             |
    ;                     |             |
    ;                     +-------------+
    ;
    ;   In the above picture, the background's position (on screen) is:
    ;
    ;       ( -Back_SizeX , -Back_SizeY )
    ;
    ;   And the player position *on screen* is:
    ;
    ;       ( -Back_SizeX / 2 , -Back_SizeY / 2 )
    ;
    ;   But, the player, being in the middle of background, with background
    ;    position orientation, e.g. a position relative to that of the
    ;    background would have the coordinates:
    ;
    ;       ( Back_SizeX / 2 , Back_SizeY / 2 )
    ;
    ;   In previous steps we used variables Player_PosX and Player_PosY
    ;    for position of player.
    ;   As we're using background orientation, let's use variables
    ;    Player_BackPosX and Player_BackPosY for position.
    ;   This position has background orientation so (0,0) doesn't necessarily
    ;    mean upperleft corner of the screen.
    ;   It means the player position in our world is relative
    ;    to that of our background.

    ;   The background shouldn't move because that is our orientation point.
    ;   If it does move, we're in trouble :)
    ;   Why, you ask?
    ;   Because then we no longer have an absolute orientation point.
    ;
    ;   First, how does the screen relate to the background?
    ;   Well, if we move the screen left, the background moves right, right?
    ;
    ;   Okay, so now we have an absolute background position/orientation.
    ;   Let's use the Back_Pos variables.
    ;
    ;   We now have a relative screen position.
    ;   So let's use the Screen_WorldPos variables.
    ;
    ;   We can use the same relative positioning system as before.
    ;   If you can remember correctly..
    ;
    ;       Screen pos = Dominant pos - World pos
    ;
    ;   So if the dominant position changes, the object itself
    ;    moves with the dominant object, because it is relative.
    ;   And the dominant object has an absolute position.
    ;   So you have at least some orientation.
    ;   How else can you know where you are without an orientation point? :)
    ;
    ;   Now, the background is actually the dominant one here.
    ;   So let's fill in the background and screen again, to see
    ;    how exactly they relate to each other now.
    ;
    ;       Back screen pos = Back pos - Screen world pos
    ;
    ;   This *is* correct, right?
    ;   Okay, let's test then..
    ;   Let's take a screen position of (-10,-10)..
    ;   And a background world position of (0,0)..
    ;   Fill it in:
    ;
    ;       Back screen pos = 0 - -10
    ;
    ;   So if our screen is at (-10,-10),
    ;    then our world is shown at (10,10).
    ;   Yeap, that seems alright.
    ;
    ;   Instead of calling it 'Screen world pos' we can also use
    ;    'view world pos' instead. Sounds better anyway :)

    ;   Now, for the player.
    ;   It's exactly the same thing.
    ;   Our player position is also relative to the background.
    ;
    ;       +-------------+
    ;       |             | - Background
    ;       |  (Player)   |
    ;       |     \       |
    ;       |      X-------------+
    ;       |      |      |      | - Screen
    ;       |      |             |
    ;       |      |      |      |
    ;       +------|- - - +      |
    ;              |             |
    ;              |             |
    ;              |             |
    ;              +-------------+
    ;
    ;   Only here, if our player is in the center of the background,
    ;    it is in the upperleft corner of the screen, like mentioned before.
    ;
    ;   So think about it..
    ;   We move the screen around and the player seems to be stuck to the
    ;    background.
    ;   So it seems, when looking at the screen, that the player 'moves with'
    ;    the background.
    ;   And if our player moves with the background, then you can actually
    ;    relate it to the background screen position, right?
    ;
    ;       (Background screen pos)
    ;          \
    ;       -···O-------------+
    ;       ^   |             | - Background
    ;    ry |   |  (Player)   |
    ;       v   |     \       |
    ;       -···|······X      |
    ;           |      .      |
    ;           |      .  +-------------+
    ;           |      .  |   |         | - Screen
    ;           +---------| - +         |
    ;           .      .  |             |
    ;           .      .  |             |
    ;           |<---->|  |             |
    ;              rx     |             |
    ;                     |             |
    ;                     +-------------+
    ;
    ;   In the pic you see 'rx' and 'ry', being the relative distance
    ;    between player and background.
    ;   You see that in our world this distance is the same as on the
    ;    screen.
    ;   So if you add the player world position to the background
    ;    screen position, you get the player position on screen, right?
    ;
    ;       Player_ScreenPos = Back_ScreenPos + Player_WorldPos
    ;
    ;   Okay, okay, so we were using Player_BackPos instead of Player_WorldPos
    ;    but it's still the same.
    ;   You can also say 'real position' instead of 'world position' so in our
    ;    case even 'background position', e.g. relative to the background.
    ;
    ;   So in our case we can use:
    ;
    ;       Player_ScreenPosX = Back_ScreenPosX + Player_BackPosX
    ;
    ;   Or, at least for dimension X :)

    Back_SizeX = GraphicsWidth ()
    Back_SizeY = GraphicsHeight ()

    ;   The player's back with its size.

    Player_SizeX = 20
    Player_SizeY = 20

    ;   Absolute background position, actually also world coordinate.
    ;   Only it's static, it doesn't change, it doesn't move.
    ;   So we have an orientation point.

    Back_PosX = 0
    Back_PosY = 0

    ;   Player stays in middle of background.

    Player_BackPosX = Back_SizeX / 2
    Player_BackPosY = Back_SizeY / 2

    ;   Instead of Screen_WorldPos, using View_WorldPos,
    ;    the world coordinate of our view/screen.

    View_WorldPosX = 0
    View_WorldPosY = 0

    SetBuffer BackBuffer ()
    Repeat

        ;   We control the view/screen with the regular cursor keys.

        If KeyDown ( 200 ) Then View_WorldPosY = View_WorldPosY - 2
        If KeyDown ( 208 ) Then View_WorldPosY = View_WorldPosY + 2
        If KeyDown ( 203 ) Then View_WorldPosX = View_WorldPosX - 2
        If KeyDown ( 205 ) Then View_WorldPosX = View_WorldPosX + 2

        ;   Calculate the background screen position.
        ;   You can also make Back_Pos a constant.
        ;   Heck you can even omit the whole constant/variable
        ;    and use '0' literally.
        ;   But this is just for the sake of clarity.
        ;   E.g. an orientation point as variable.

        Back_ScreenPosX = Back_PosX - View_WorldPosX
        Back_ScreenPosY = Back_PosY - View_WorldPosY

        ;   As for the player, same as explained before.

        Player_ScreenPosX = Back_ScreenPosX + Player_BackPosX
        Player_ScreenPosY = Back_ScreenPosY + Player_BackPosY

        Rect Back_ScreenPosX , Back_ScreenPosY , Back_SizeX , Back_SizeY , False
        Rect Player_ScreenPosX , Player_ScreenPosY , Player_SizeX , Player_SizeY , False
        Flip
        Cls

    Until KeyHit ( 1 )
    End