• Advertisement

Archived

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

Guest Anonymous Poster

Scrolling a map(vertical only)

This topic is 6756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
I really need help on this...so please help

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I'm trying to scroll my map vertically. I having some trouble though. BAsically I want my map to automatically scroll vertically, but I'm not too sure how to do this. coudl someone help...here's the code:


#include "defines.h"
int mapRow, mapIndex, tileIndex;
typedef struct
{
int posx;
int posy;
int obs;

}CELL;

CELL cells[]={
// x, y

{0,0},
{0,0},// blank wall 1
{0,64}, // 2
{0,128}, // 3
{0,192}, // 4
{0,256}, // 5
{0,320}, // 6
};


int MapOne[GAME_PORT_HEIGHT][GAME_PORT_WIDTH] = {
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{3,3,3,1,2,1,3,1,1,1},
{1,1,1,1,1,1,3,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,2,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1},
{1,1,1,2,1,1,1,1,1,1},
};

void DrawBase()
{

int tileSize = 64;
RECT tileRect;
int destx, desty;

for (mapRow = 0; mapRow < GAME_PORT_HEIGHT; mapRow++)
{
for (mapIndex = 0; mapIndex < GAME_PORT_WIDTH; mapIndex++)
{

tileIndex = MapOne[mapRow][mapIndex];
if(tileIndex > 0)
{
tileRect.left = cells[tileIndex].posx;
tileRect.top = cells[tileIndex].posy;
tileRect.right = tileRect.left + tileSize;
tileRect.bottom = tileRect.top + tileSize;

destx = mapIndex * tileSize;
desty = mapRow * tileSize-640;

BlitSurface( lpDDSOffscreen, lpDDSBack, destx,desty,&tileRect, FALSE);
}

}

}
}


Share this post


Link to post
Share on other sites

  • Advertisement