PDA

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




slooksterPSV
Jun 9, 2006, 03:54 AM
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



slooksterPSV
Jun 9, 2006, 03:53 PM
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.

...
HandleUpdate(mc->GetCenterX()-camera.x, mc->GetCenterY()-camera.y, playertemp, g_Window, NULL);
...

slooksterPSV
Jun 9, 2006, 05:30 PM
I got it fixed but now I'm having another problem. the first two rows of tiles won't show up.