?
Solved

How to I make my background scroll. I am developing a game using c# and directX.

Posted on 2005-03-01
6
Medium Priority
?
681 Views
Last Modified: 2013-12-08
I have a game in c# and directX and want to put in a scrolling background. This is a 2D game. All help greatly appreciated.
0
Comment
Question by:pmaguire9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 13434341
There are many approaches to scrolling a background, it depends on what the PRECISE effect is you want to obtain, and how large a 'virtual scrolling' section you intend.

For instance, if you have a fixed/wrapping background, larger than one screen width, you can 'simply' offset the coordinates into a large texture, shifting them, and when both side have 'wrapped' off the end you 'jump' them back based off 0,0.

If you want a very dynamic background, you can build it using individual 'tile' graphics.  Each frame, you can completely re-image the background at whatever the current offset is -- with DirectX (Direct3D), all the textures/tiles can be in hardware, makes it really fast to render any tiled layout.

-d
0
 
LVL 1

Assisted Solution

by:lplayer
lplayer earned 500 total points
ID: 13467231
Rather than explain lots of detail here I would suggest you look at:

http://www.gpwiki.org/index.php/Framing_Buffer_Tile_Scrolling_Algorithm

The example relates to VB but the site also containd C++ code too.

0
 
LVL 17

Expert Comment

by:davebytes
ID: 13474055
right.  that only deals with one particular case of tiling, and a somewhat fixed one at that.  what the game IS, how smoothly it wants to scroll, how fixed/dynamic is the background, etc., all play into the answer.

But otherwise, that's a decent link.  However, there's a ton more over at gamedev.net, dealing with a variety of different background methods.  Search on 'scrolling' and you'll see all the links.

-d
0
 
LVL 17

Expert Comment

by:davebytes
ID: 14148815
if you need more help, please ask.  otherwise, this question should be closed or accepted.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question