Learn C# and game programming

C# Tutorials

Hello and welcome to my C# tutorials section.  Most of my introduction is included the first tutorial, but this set of tutorials will take you from knowing absolutely nothing about programming to the point of programming a full graphical game using XNA.  This is a no cost way of learning programming.  Most tutorials come in two flavors: HTML and the original text document.  The text documents good for printing off code, but lack graphics.

There will be a few revisions and edits to the tutorials as time allows.

Tutorial 1: Introduction and some quick information  Tutorial 1: text document 

Tutorial 2: FAQ, some tips, and Do's and Don'ts  Tutorial 2: text document

Tutorial 3: Introdution to Visual C#, your first program and how a program runs  Tutorial 3: text document

Tutorial 4: "Hello World" explaination and variables introduction  Tutorial 4: text document

Tutorial 5: Using variables and operators to manipulate our variables  Tutorial 5: text document

Tutorial 6: Loops, switches and debugging  Tutorial 6: text document

Tutorial 7: The Random class, and using loops in a more meaningful way  Tutorial 7: text document

Tutorial 8: Introduction to methods and some of their uses; Introduction to static  Tutorial 8: text document

Tutorial 9: The Solution Explorer and Class Introdution  Tutorial 9: text document

Tutorial 10: Using class in games  Tutorial 10: text document

Tutorial 11: Class in games continued, and Simple AI  Tutorial 11: text document

Tutorial 12: Introduction to Inheritance  Tutorial 12: text document

Tutorial 13: Inheritance in games  Tutorial 13: text document  Tutorial 13 Solution zip file   Tutorial 13 code-text document

Tutorial 14: Inheritance in games continued, updating the game  Tutorial 14: text document

Tutorial 15: Arrays and regions   Tutorial 15: text document

Tutorial 16: Generics and structs   Tutorial 16: text document

Tutorial 17: Enums and Properties   Tutorial 17: text document

Tutorial 18a: The full code-text file 

Tutorial 18b: The run down    Tutorial 18b: text document

Tutorial 19: Load/Save      Tutorial 19: text document

Tutorial 20: Reference vs. Value

RpgTutorial.zip  - Source Code  -The code for the Rpg through Tutorial 19

XML basics - A basic introduction to XML and how to use it with C#, as well as the RPGTutorial modified to XML instead of text (XMLexample.zip source code)  (RPGTutorialXML.zip source code)

<SCRIPT language=javascript>postamble();</SCRIPT> <SCRIPT language=javascript>postamble();</SCRIPT> <SCRIPT language=javascript>postamble();</SCRIPT>

XNA Tutorials

XNA Tutorial 1: Introduction to XNA, it's methods and new features [XNA 2.0] 

XNA Tutorial 2: Graphics, Text and Time    [XNA 2.0]     Tutorial 2: Graphic

XNA Tutorial 3: Input, Movement and Collisions  [XNA 2.0]  XNA Tutorial 3- Reference File 1   Reference File 2

XNA Tutorial 4: Programming Pong   [XNA 2.0] XNA Tutorial 4- Reference File 1  Reference File 2   Reference File 3

XNA Tutorial 5: Moving by a rotated vector  [XNA 2.0]  Before you start this tutorial I have a sample for you to look at as well you should read the article on Sine and Cosine.   If you're not familiar with Trig or it's been awhile since you've used it, have no fear, it will all be explained in the next tutorial.  The sample has everything broken down and you use the arrow keys to move. 

XNA Tutorial 6: Adding some polish  [XNA 2.0]  -Final Pong solution-

XNA Advanced

These are more like articles about certain XNA features and other misc things than a continuing series of tutorials.  More will be added over time.

Dissecting Series: Article 1- The GameStateManagement Sample -Part1(text document version)  We can rebuild it. Better. Stronger. Faster.  Well we can at least rebuild it.  In this article we will go over how the sample works, and make a basic one of our own to use in our own games.

Reusable Class Series: Article 1- The Animation Class  -(text document version) (Animation Sample) -In this tutorial we will build an Animation class for 2D animations.  Aside from shattering the record for the number of times anyone has used the word Animation, this will be useful for almost any 2D game.

Reusable Class Series: Article 2 - A Mouse Class -  This time around we will build a mouse class with standard windows functionality.  This means your typical clicks, drag and drop and the scroll wheel.  A good time saver if you need a mouse interface.  (Sample Solution)

Reusable Class Series: Article 3 - Another Math Class - In this third article we will make a static class of additional common math problems as well as other reoccuring formulas that you keep seeing time and time again in 2D.  This should help save you time and space.

Building a game in 5 days- Lessons learned-  A few quick thoughts on my experience of making a dream build play game in a limited amount of time.  There's short log on the development process as well as some advice when building a game, whether its in a specific amount of time or not.

Give it a Rest source code - The game used modified versions of both the game state sample and the animation class.  If you wanted more examples of them being used, here's a chance to see them in action.

Making a basic GUI - Part 1 - This covers the introduction and basic structure for the GUI.  You can find the source code for it here.

Making a basic GUI - Part 2 - In this tutorial we will get our program able to enter the data and change it around, as well as resizing our map. -Reference file 1  -Reference file 2-

Making a basic GUI - Part 3 - In the final tutorial we will cover loading, saving and making a new map.  -Reference file-  -TileGUI Solution-

I went ahead and added a bit more to the GUI, adding scaling, and transitions for grass/water.  While this is still basic, there's a bit more functionality to it now.

Sprite Sheet Utility (XNA 2.0) -  This utility is for selecting the sprites on a sprite sheet and saves them in an XML sheet for use in any game.  I figure I can't be the only one to get tired of selecting the sprites by direct input.