Archived

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

proveren

DirectDraw based scrolling problem

Recommended Posts

I made a simple tile-based scrolling game. I made the scrolling by creating a clipped surface with the size of the screen and then making all of the tiles be clipped sprites and draw them according to the viewpoint. //viewpointx & viewpointy are in pixels for(j=viewpointy/TILESIZE;j<=MAXDISPLAYEDTILESY+viewpointy/TILESIZE;j++){//<= because it is pixel based scrolling and in most cases i have to display the max tiles displayed + offe more for(i=viewpointx/TILESIZE;i<=MAXDISPLAYEDTILESX+viewpointx/TILESIZE;i++){ tileptr->draw(tile[j],i*TILESIZE-viewpointx,j*TILESIZE-viewpointy,SecondarySurface); } } This works fine only when viewpointx!=0 or viewpointx!=0, otherwise when i am in the top left corner it gets very slow. I am first asking whether there is a more elegant and/or faster way to make scrolling in a tilebased game, instead of making all the tiles clippedsprites on a clipped surface. If there isn.t(which i doubt), i would then ask you what the problem is. [edited by - proveren on March 20, 2004 3:04:31 AM]

Share this post


Link to post
Share on other sites