Scrolling background in C# Winform??
-
Hey guys, Im in the process of creating a 1941-type shooter set in outer space. I have a simple jpeg of distant stars I wanted to set as the background. How can achieve this? And if possible, how can I make it scroll as if my spaceship appears to be moving? Thanks for any help.
-
Hey guys, Im in the process of creating a 1941-type shooter set in outer space. I have a simple jpeg of distant stars I wanted to set as the background. How can achieve this? And if possible, how can I make it scroll as if my spaceship appears to be moving? Thanks for any help.
That's going to be a problem. A scrolling background on a Windows form means that the background will be redrawing every time the image scrolls even one pixel. That will also force a redraw of every control on the form. The more controls you have, the more time it takes to generate a single frame in your game. The best solution you have is to use DirectX. But, that would require a complete rewrite of your game. You might want to look into Microsoft's XNA Developer's Center[^] first.
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Hey guys, Im in the process of creating a 1941-type shooter set in outer space. I have a simple jpeg of distant stars I wanted to set as the background. How can achieve this? And if possible, how can I make it scroll as if my spaceship appears to be moving? Thanks for any help.
In 2D Games with the tpye you want: 1) There is a screen size background image and you draw onto a part of this big background image and update(Invalidate) just that part so because the user does see only a small portion of the big background image, he thinks he is moving in some directions ;) 2) Have a look at Code4Fun web site, where you can find some tutorials on game development. Hope this helps...