Here is some pseudocode:<br>
<br>
typedef struct Tile_t<br>
{<br>
int nImageIndex; // Points to whatever image you're using.<br>
}<br>
Tile_t<br>
<br>
main loop:<br>
<br>
//Let's assume that you want to scroll one pixel to the right and want your tiles to move one pixel to the right instead of a whole tile.<br>
<br>
X_Offset = 1; // Because you want to move one pixel more.<br>
<br>
Y_Offset = 0; // The Y doesn't change in this instance.<br>
<br>
for each tile:<br>
<br>
// Blit (dest, source, X, Y, Width, Height);<br>
<br>
blit ( Screen, image[Tile[x,y].nImageIndex], Tile[x,y].X + X_Offset, Tile[x,y].Y + Y_Offset, image[Tile[x,y].nImageIndex].width, image[Tile[x,y].nImageIndex].height);<br>
<br>
<br>
<br>
Now you will have to account for setting the offset back to 0 and setting the full tile offset over by one once you've moved an entire tile-width over so you don't run up a huge offset number.<br>
<br>
-Xotor-<br>
<br>
: Hmm, Im a tiny bit confused, lemme kind of map out how my tile system works and then maybe you can explain through that.<br>
: <br>
: First off I create a structure in my main.h<br>
: typedef struct IMAGE<br>
: {<br>
: Point location;<br>
: short width;<br>
: short height;<br>
: short imageID[3];<br>
: }IMAGE;<br>
: This defines all of the tile info.<br>
: Next I have a sequence to load in each of my tiles: <br>
: dpSetWindow(OFFSCREEN);<br>
: String BFname = "Data/World1.txt";<br>
: <br>
: bg.location = dpMakePoint(x, y);<br>
: bg.width = 32;<br>
: bg.height = 32;<br>
: bg.imageID[1] = dpLoadImage(1, BFname);<br>
: bg.imageID[2] = dpLoadImage(2, BFname);<br>
: bg.imageID[3] = dpLoadImage(3, BFname);<br>
: <br>
: /*Destination bounds */<br>
: bgDest = dpMakeRect(bg.location.h,<br>
: bg.location.v,<br>
: bg.location.h + bg.width,<br>
: bg.location.v + bg.height);<br>
: Once I loaded in each of the bitmaps with a number (1,2,3) I made a world[15][30] array for the tile locations.<br>
: <br>
: then my loop looked a little bit like this.<br>
: <br>
: while(!Done2)<br>
: {<br>
: //when the array is done end the loop<br>
: if ((width == y1-1) && (height== x1-1))<br>
: Done2 = true;<br>
: worlds();<br>
: //loop to set up the tiles<br>
: <br>
: //stops program from placing tiles past the array's limit<br>
: if ((bgDest.right>widthofscreen) && (bgDest.bottom<480))<br>
: {<br>
: bgDest.top +=sizeoftiles; <br>
: bgDest.bottom +=sizeoftiles;<br>
: bgDest.left =0;<br>
: bgDest.right =32;<br>
: }<br>
: <br>
: //stops the array from going past it's limit<br>
: if ((width==y1) && (height<x1))<br>
: {<br>
: width = 0;<br>
: height++;<br>
: }<br>
: <br>
: drawbackground();<br>
: <br>
: //increments by tiles_size<br>
: width++;<br>
: bgDest.left +=tiles_size;<br>
: bgDest.right +=tiles_size;<br>
: <br>
: //Wait(30);<br>
: }<br>
: <br>
: <br>
: This may not make any sense since you have probably not used the library, but I tried, and hopefully you have seen something similar. If not that is allright, I can probably figure out your answer through comparin Allegro to my library file. <br>
: <br>
: Thanx again Xotor, and yeah this messageboard really sucks.<br>
: <br>
: <br>
<br>