Skip to main content
Pseudo Code
Source Link
benh
  • 581
  • 4
  • 12

All you need to do is say that when the projectile is past halfway in the X direction, you should center the camera on the projectile until the camera cannot go any further.

edit: pseudo code as requested

//Check that projectile is past half the screen width if projectile.x > (screenwidth / 2) //get background to follow projectile background.xPos = -1 * (projectile.x - (screenwidth/2)) # Draw the projectile in the middle of the screen projectile.drawposX = screenwidth / 2

All you need to do is say that when the projectile is past halfway in the X direction, you should center the camera on the projectile until the camera cannot go any further.

All you need to do is say that when the projectile is past halfway in the X direction, you should center the camera on the projectile until the camera cannot go any further.

edit: pseudo code as requested

//Check that projectile is past half the screen width if projectile.x > (screenwidth / 2) //get background to follow projectile background.xPos = -1 * (projectile.x - (screenwidth/2)) # Draw the projectile in the middle of the screen projectile.drawposX = screenwidth / 2

Source Link
benh
  • 581
  • 4
  • 12

All you need to do is say that when the projectile is past halfway in the X direction, you should center the camera on the projectile until the camera cannot go any further.