Dear Ilan,
not exactly to do with the ratio.
If the the little guy is jumping than the blue background gets bigger since the World is sinking down. Or if ihe goes down the world the one can see the blue part below the world. Sure at the sides the same.
Means this world is not only bigger horizontally also vertically and therefore vertical scrolling is needed, too.
here the example for moving around in both directions but the screen doesn't stop at the world edge.
' ####################################################
Dim WorldFixX As Float, WorldFixY As Float
' horizontal
If bw.X2.ScreenAABB.TopRight.X - bw.Body.WorldCenter.X < MIN_DISTANCE_TO_SIDES Then
'
WorldFixX = MIN_DISTANCE_TO_SIDES - (bw.X2.ScreenAABB.TopRight.X - bw.Body.WorldCenter.X)
Else If bw.Body.WorldCenter.X - bw.X2.ScreenAABB.BottomLeft.X < MIN_DISTANCE_TO_SIDES Then
'
WorldFixX = -(MIN_DISTANCE_TO_SIDES - (bw.Body.WorldCenter.X - bw.X2.ScreenAABB.BottomLeft.X))
End If
' vertical
If bw.X2.ScreenAABB.TopRight.Y - bw.Body.WorldCenter.Y < MIN_DISTANCE_TO_SIDES Then
'
WorldFixY = MIN_DISTANCE_TO_SIDES - (bw.X2.ScreenAABB.TopRight.Y - bw.Body.WorldCenter.Y)
Else If bw.Body.WorldCenter.Y - bw.X2.ScreenAABB.BottomLeft.Y < MIN_DISTANCE_TO_SIDES Then
'
WorldFixY = -(MIN_DISTANCE_TO_SIDES - (bw.Body.WorldCenter.Y - bw.X2.ScreenAABB.BottomLeft.Y))
End If
'
If WorldFixX <> 0 Or WorldFixY <> 0 Then
'update the screen center
Dim center As B2Vec2 = bw.X2.ScreenAABB.Center
If WorldFixX <> 0 Then center.X = center.X + WorldFixX
If WorldFixY <> 0 Then center.Y = center.Y + WorldFixY
bw.X2.UpdateWorldCenter(center)
' bw.mGame.WorldCenterUpdated(WorldFix)
End If
' ###################################################
Greetings.