HELP: Scrolling in SDL, have code, just need help fixing it

Discussion in 'Mac Programming' started by slooksterPSV, Jun 9, 2006.

  1. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #1
    I found a great tutorial out there on the internet that shows how to do scrolling for your games and that. I implemeted this using all kinds of work arounds and memory tools. Anyways, here's the problem, when I scroll to the right or the bottom too far it shows a black box the height or the width of the screen, respectively. I'm not sure what piece of code fixes this, but I need help fixing it. Also, the character moves 3x faster when it scrolls as well. Here's the link to my entire source project.

    ... I'm not sure if I did or didn't, but there may be code that prints to the stderr file with locations. -- I'm using XCode 2.3 btw, and its a Univ Binary, and you have to have SDL 1.2.10 installed (compile and build it), http://rapidshare.de/files/22604081/CSliceUniv.zip.html
    http://rapidshare.de/files/22604081/CSliceUniv.zip.html
    http://rapidshare.de/files/22604081/CSliceUniv.zip.html there's the link
     
  2. thread starter macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #2
    If I do it like the author of the original code did it, blitting the character with an offset of the characters x - camera's x and the characters y - camera's y then it duplicates the screen bitmap and walks with the user. E.g.
    Code:
    ...
    HandleUpdate(mc->GetCenterX()-camera.x, mc->GetCenterY()-camera.y, playertemp, g_Window, NULL);
    ...
    
     
  3. thread starter macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #3
    I got it fixed but now I'm having another problem. the first two rows of tiles won't show up.
     

Share This Page