Archived

This topic is now archived and is closed to further replies.

webmunkey

Help! My Tile Scrolling Is Disfunctional !?!

Recommended Posts

webmunkey    122
Hey, Here is the code that I use to define the xpos[] and ypos[] for the tiles just before drawing them... void DrawMap(void) { int startx = camerax; int starty = cameray; int endx = camerax + 640; int endy = cameray + 480; xpos[0] = startx; ypos[0] = starty; for (int i = 1; i < 300; i++) { currentFrame[i] = 0; xpos[i] = xpos[i - 1] + 32; ypos[i] = ypos_identifer; if (xpos[i] >= endx) { xpos[i] = startx; ypos_identifer += 32; } } // draw tree, tree frame = 1 for (i = 0; i < 300; i++) { if ((xpos[i] == 192) && (ypos[i] == 192)) currentFrame[i] = 1; } ypos_identifer = 0; } and to scroll I just have camerax or cameray += 4, however when I do this and call the DrawMap() function again the game crashes! Does anyone know why? Also is there a better way to do what the above code does? Please help! Thanks... Edited by - webmunkey on August 3, 2001 10:30:02 PM

Share this post


Link to post
Share on other sites