10 is to Right from point 0, the axis... When object position X increases, it is going right, yeah? If you want it in the middle of screen, you just have to set the camera coordinates properly. For example focused where player is, it would be cameraPosition = PlayerPosition - ScreenSize/2
Code:
camX:=player.X-clientwidth/2;
camY:=player.Y-clientheight/2;
object[n].Draw(object[n].X-camX, object[n].Y-camY);
So if player is at 0, 0, and object would be drawn to 0, 0, it would be in the middle of the screen. Or if player.X is something big 1000, it is natural that object is drawn off the screen far to left.
edit: For horizontal shooter you have it simple, and can set camY is always 0. Although some games such as classic Tyrian allows some horizontal scrolling aswell, being vertical scroller mainly.
Bookmarks