Help! My Tile Scrolling Is Disfunctional !?!
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 = 0;
xpos = xpos + 32;
ypos = ypos_identifer;
if (xpos >= endx)
{
xpos = startx;
ypos_identifer += 32;
}
}
// draw tree, tree frame = 1
for (i = 0; i < 300; i++)
{
if ((xpos == 192) && (ypos == 192))
currentFrame = 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… </i>
Edited by - webmunkey on August 3, 2001 10:30:02 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement