Jump to content
  • Advertisement


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


DirectDraw based scrolling problem

This topic is 5234 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

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!