Machaira's Blog

Jim Perry's Blog at vbCity

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

AugSeptember 2006Oct
SMTWTFS
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

Articles

Archives

.NET Development Links

Game Development Links

Miscellaneous Links

Wednesday, September 20, 2006 #

Just threw together a quick tutorial (under the Game Development article section) on animated sprites using XNA Game Studio Express. It's so much fun to work with I should be paying Microsoft (but it's all free!) :)
posted @ 1:59 PM

So I've been playing with GSE for a couple days (I got off to a late start as I went on vacation the day after it was released) and I'm loving it. Why? The GSE team has made it ridiculously easy to get an XNA app running, basically a couple of clicks. Let's see:

  1. Fire up C# 2005 Express
  2. Click the Create Project link on the Start Page
  3. Select Windows Game (XNA) and give it a title
  4. Click OK

That's it - 4 steps. Granted, it's not Half-Life 3, but there's a ton of stuff that gets added behind the scenes to make managing your game very easy. Want to show a sprite? Here ya go:

Add the following to the Game1 class that gets created above:

private SpriteBatch _batch;
private Texture2D _sprite;

Add the following to the constructor:

_batch = new SpriteBatch(this.graphics.GraphicsDevice);
_sprite =
Texture2D.FromFile(this.graphics.GraphicsDevice, "sprites.dds");

Add the following to the Draw() method:

_batch.Begin(SpriteBlendMode.AlphaBlend);
_batch.Draw(_sprite,
new Rectangle(0, 0, 128, 128), new Rectangle(0,0,128,128), Color.White);
_batch.End();

Wanna make that an animated sprite? Just a couple of lines more code since someone's already released a class to handle it for you. The GSE community has been steadily releasing samples and tutorials since the release of GSE.

I urge anyone that's interested in doing indie game development to check out GSE. I for one can't wait to see my games running on my 360. :)

 

posted @ 1:10 PM