#### Archived

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

# Tile Scrolling Problem(with demo)

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

## Recommended Posts

Rather than trying to explain the problem I'll show it to you. Here's the download. Basic Tile Well, here's a lil description of the problem, when I move the screen in either direction, the previous position is still showing. What I'm trying to do is move the screen around, while leaving black on the outside of the frame. The download is only 56kb(3files). The code is brutish as this is my first time dabbling in tile scrolling. Note: Just fixed the download to link to the site(cant directly link to the file from an outside page). The link to the demo is right on that site. Thanks Edited by - _Rederick on 8/31/00 6:53:33 PM

##### Share on other sites
Ummm.. Am I the only person getting a Forbidden warning from the Web Server when trying to download?

##### Share on other sites
Well, the program says surface init failed, so I''m not sure exactly what it''s doing, but providing I understand what you mean, I think you just need to write a little function to draw a black rectangle over your surface before redrawing the tiles.

-Deku-chan

"I''m dropping like flies!" - me, playing Super Smash Bros. (and losing)
"What fun!" - me, playing Super Smash Bros. (and beating the crap out of somebody)

##### Share on other sites
Ok I just fixed the initsurface fail thing. It should load up now. And btw, I think you''re right. But the question is, should i blit the black rectangle to another offscreen surface, or right to the back buffer?

Thanks!

##### Share on other sites
Hi there,

think this may be the problem

  for (x = 0; x < WORLD_SIZEX; x++) { for (y = 0; y < WORLD_SIZEY; y++) { if (phase) //tile = map[x][y]; tile = map[x + i][y + j]; else //tile = map2[x][y]; tile = map[x + i][y + j]; tile_src.left = (tile - 1) * TILE_SIZE; tile_src.top = 0; tile_src.right = tile * TILE_SIZE; tile_src.bottom = TILE_SIZE; //g_pDDSBack->BltFast((j+x) * TILE_SIZE, (k+y) * ILE_SIZE, g_pDDSOne, &tile_src, NULL); g_pDDSBack->BltFast((x) * TILE_SIZE, (y) * ILE_SIZE, g_pDDSOne, &tile_src, NULL); } } }

Hope this helps (I havent tested it myself)

##### Share on other sites
Whoa hehe, you''re code made the scrolling screwy. But thanks for the attempt. All help is needed. Question. Did you mistake j, k for i, j? Maybe me switching them around had something to do with it. There''s no i''s in my code so i make your "i" my "j", and your "j" my "k"

  for (x = 0; x < WORLD_SIZEX; x++) { for (y = 0; y < WORLD_SIZEY; y++) { if (phase) //tile = map[x][y]; tile = map[x + j][y + k]; else //tile = map2[x][y]; tile = map[x + j][y + k]; tile_src.left = (tile - 1) * TILE_SIZE; tile_src.top = 0; tile_src.right = tile * TILE_SIZE; tile_src.bottom = TILE_SIZE; //g_pDDSBack->BltFast((j+x) * TILE_SIZE, (k+y) * ILE_SIZE, g_pDDSOne, &tile_src, NULL); g_pDDSBack->BltFast((x) * TILE_SIZE, (y) * TILE_SIZE, g_pDDSOne, &tile_src, NULL); } }

• 15
• 11
• 9
• 49
• 12
• ### Forum Statistics

• Total Topics
631389
• Total Posts
2999727
×