Tile Scrolling Problem(with demo)

Started by
4 comments, last by _Rederick 23 years, 8 months ago
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
Advertisement
Ummm.. Am I the only person getting a Forbidden warning from the Web Server when trying to download?

Jim Adams
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)
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!
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)

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);		   }	}    

This topic is closed to new replies.

Advertisement