Results 1 to 8 of 8

Thread: Scrolling equations?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    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.
    Last edited by User137; 01-06-2013 at 03:57 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •