65.9K
CodeProject is changing. Read more.
Home

Star Fighter

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.06/5 (27 votes)

Oct 26, 2003

1 min read

viewsIcon

98893

downloadIcon

3150

A quick and dirty example to make a Star Fighter game using forms with C#

Sample Image - starfighter2.jpg

Introduction

There aren't really too many game programming examples with the C# language...not yet. Coming from a game programming background, I decided to whip one up with Visual Studio .NET. The final result after 2 hours of coding: Star Fighter 1.0.

Method

Instead of digging deep into the DirectX interface, I decided to just use simple Windows Forms. The process is quite simple. The entire game loop is handled by a simple form timer event which processes the ship movement, aliens movement, bombs, and bullets. Keyboard input is done by the keydown handler event. The entire code is self explanatory and fairly documented. Graphics were ripped from Blitz3d's demo game "Insectoids".

Bugs

Just a warning to everyone, Windows Forms is not the best method for intense action graphics, and if you experience some poor performance and slowdowns, it's normal. I ran this code using a P4 3.02 ghz and it went smoothly for me but others reported extreme slowness. Also, there's an annoying bug when the ship gets hit by the alien's bomb which causes the game to end - that which I could not figure out after a half an hour of debugging.

Questions, Comments, Complaints

For more projects, game demos, C# programming visit my website: http://www.3d-design.0catch.com/.

Have fun!

History

  • 26th October, 2003: Initial version

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.