Tutorial Packs 7 and 8
Two new tutorials. Updated the Download page as well.
XNA Video Pack 7 (Download)
Video 21 is more theoretical, dealing with Implicit and Explicit Casting, Increment and Decrement Operators, Assignment Operators, and While and For Loops.
Video 22 is practical, writing the system to extract a single sprite from a sprite sheet.
Video 23 is again theoretical, and goes through Generics, Type Parameters, and the .Net Generic List.
XNA Video Pack 8 (Download)
Video 24 uses a Generic List to store several frames of an animation, in an Animation class which inherits from the Image class.
Video 25 goes through some less-important vocabulary of .Net and C#, such as assemblies and the different parts of IntelliSense.
Beta 2 and Final Version
I’ve recompiled the code of each solution released, from Video number 1 and forward. They all compiled without a hitch, and run as expected
I’m considering them as XNA 1.0 material unless I hear from anyone with a problem.
What happened to Video Pack 6?
Video Pack Five was so big I repacked it as two video packs - 5 and 6. I’m trying to keep each download at 10 megabyte, plus-minus a few, and it was over twenty megabyte.
Cheers!
Joran




on December 13th, 2006 at 12:32 pm
tusen tack!
on December 13th, 2006 at 5:24 pm
Hey, Joran.
I have started watching your turitorials a week ago and I just finished with your latest packs. I really appriciate what you are doing and I hope you keep it up.
Now there is one thing I would like to request of you. Could you make a single video where you go over the entire code and show how it is processed. Like the way the computer reads the code and what it does during each specific part of the code. I think this will give the viewer a better understanding of how the code is being executed. I for one, understand how the computer reads through it but there are some parts that really confuse me like the whole math calculations that it does in the if statements and for loops.
Also, could you explain to me what the properties do and what significance they have in the program. I am a little confused as to what they are for.
Thanks, and keep up the good work. ^__^
on December 13th, 2006 at 7:29 pm
Orvar: “tusen tack!”
Varsågod! (c:
Vahid: “Could you make a single video where you go over the entire code and show how it is processed.”
Sure, I’ll give it a try.
Vahid: “could you explain to me what the properties do and what significance they have in the program”
I’ll try to clearify that in the video too.
Cheers!
Joran
on December 13th, 2006 at 7:35 pm
Thanks Joran. I will be looking forward to it.
on December 13th, 2006 at 10:24 pm
I love your videos, I have recently caught up through tutorial 5 (i guess 6 now that you changed them around) and want you to know that you are great at teaching us step by step to work with xna. I am glad to watch another installment of your great teaching aid. Keep up the good work!
on December 14th, 2006 at 1:24 am
Axus: “you are great at teaching us step by step to work with xna”
That makes me feel all warm and fuzzy inside.
I lilke it… Thank you!
Cheers!
Joiran
on December 14th, 2006 at 3:38 am
Thank you for all your great tutorials. they have helped med a lot. Keep ‘em comin’!
God Jul!
on December 14th, 2006 at 1:16 pm
Good job man! Please have a good holiday and then make more!
on December 14th, 2006 at 3:42 pm
Just skip the holiday and make more! JK
Have a great holiday and keep up the good work on these excellent tutorials :D.
on December 15th, 2006 at 7:32 am
Martin: “Thank you for all your great tutorials. they have helped med a lot. Keep ‘em comin’!”
adrian: “Good job man! Please have a good holiday and then make more!”
Tommy: “Just skip the holiday and make more! JK Have a great holiday and keep up the good work on these excellent tutorials”
Three happy campers in a single day! Maybe I’ll just skip the holidays and do Farseer right now. (c:
I’m supposed to be out Christmas shopping, yet I’m sitting here. I must be sick. (c:
I do appreciate the feedback. Thank you, all of you!
Cheers!
Joran
on December 21st, 2006 at 1:43 am
Hej!
Just thought I should encourge your great work here, I have watched your videos and although I’m not that new to C#, I am new to XNA (and directX) and so far have found most if your videos very informative and helpful.
Hope to get starting with XNA soon too and with more of your videos comming I’m sure my inspiration will build up until I cannot resist any more…
on January 4th, 2007 at 10:16 pm
You are one of the greatest educators I have ever run across. I could have never understood all that’s involved in game programming with out your videos. Thanks, you make OOP so easy.
Please, if you could, make that video that explains how everything is executed, as mentioned above “Vahid: “Could you make a single video where you go over the entire code and show how it is processed.”
I for one would benefit from that video.
I would also like to say, thank you for not missing even the most simplest of points, because that’s where I usually get lost on most tutorials.
on January 5th, 2007 at 8:42 am
Vahid and Gerald, could you guys specify more clearly what it is that you are looking for?
I tried in video pack 9 to include a video on the subject, but I must obviously have missed what you wanted, since that was published before Gerald made his comment.
You want me to step through the code, line by line, showing how they are connected? That is a bit difficult, since the Engine class inherits from Game, which is not open for public viewing by mere mortals like us.
Don’t hesitate to tell me. I’ll make the video if I know what you’re looking for.
Cheers!
Joran
on January 12th, 2007 at 1:39 pm
I have a question? How does adding 3d models work? do you control there movements with the code, like a person walking or do you make a movie and use the code to play that movie. Can you make a tutorial on first person shooters or adding in a 3d model and controling its movements?
Thanks,
Jonathan
on January 15th, 2007 at 12:03 am
Jonathan: “Can you make a tutorial on first person shooters or adding in a 3d model and controling its movements?”
Yes, I can, about a year from now, when we’re done with the 2D side-scroller, and have remade it into a 3D side-scroller.
In the meantime, start reading:
xna101.net
And when you’re done with that, read:
riemers.net
And then you should be well on your way!
Cheers!
Joran
on February 5th, 2007 at 5:27 pm
Hi Joran,
I’m enjoying your tutorials very much. Anxiously awaiting the next installments. I have a bit simpler method for converting your index into Sprite Sheet X and Y coordinates. Note: My version goes across the texture instead of down:
Hi Joran,
I’m enjoying your tutorials very much. Anxiously awaiting the next installments. I have a bit simpler method for converting your index into Sprite Sheet X and Y coordinates. Note: My version goes across the texture instead of down:
#region Initialize Methods (CalculateSource)
protected Rectangle CalculateSource(int index)
{
int framesAcross = this.texture.Width / (int)this.dimensions.X;
int framesDown = this.texture.Height / (int)this.dimensions.Y;
if (index framesAcross * framesDown)
{
return new Rectangle(0, 0,
(int)this.dimensions.X, (int)this.dimensions.Y);
}
else
{
// Store Division result as Int, which drops any decimals. Telling us how many full rows there are.
int indexY = index / framesAcross;
// Subtract number of complete rows * number of frames across texture, from total index.
// The remainder tells us how many frames are left in incomplete row. Giving us the X coordinate of the current frame
int indexX = index - (indexY * framesAcross);
return new Rectangle(indexX * (int)this.dimensions.X, indexY * (int)this.dimensions.Y,
(int)this.dimensions.X, (int)this.dimensions.Y);
}
}
#endregion
on February 5th, 2007 at 6:38 pm
Thank you very much, Dillinger! That’s very nice and clean code you got there. I’ll put that in the repository I’m building (not public yet).
Cheers!
Joran
on February 6th, 2007 at 12:44 pm
hmm, there seemed to be a minor error in the code. Here it is one more time for clarity.
Note: my version starts at 0, not 1, so you would have to change your sprite initialization. I think it’s cleaner than adding 1. Also I added: if index is greater than max sprite sheet. This was because when I was using the sprite sheet to jump to different sequences: Jump, Duck, Crawl, etc. and I went from a high sequence down to a low one, the counter would continue incrementing. This ensures that the index will always stay inside the sprite sheet.
#region Initialize Methods ( CalculateSource)
/// Convert Index number into 2 Dimensional SpriteSheet coordinates
/// The number of the current frame starting at 0
/// Rectangle coordinates defining texture segment of SpriteSheet
protected Rectangle CalculateSource(int index)
{
int framesAcross = this.texture.Width / (int)this.dimensions.X;
int framesDown = this.texture.Height / (int)this.dimensions.Y;
if (index < = 0 OR index >= (framesAcross * framesDown))
if index is less than or equal to 0 OR index is greater than framesAcross * framesDown
{
return new Rectangle(0, 0, (int)this.dimensions.X, (int)this.dimensions.Y);
}
else
{
// Store Division result as Int, which drops any decimals. Telling us how many full rows there are.
int indexY = index / framesAcross;
// Subtract number of complete rows * number of frames across texture, from total index.
// The remainder tells us how many frames are left in incomplete row. Giving us the X coordinate of the current frame
int indexX = index - (indexY * framesAcross);
return new Rectangle(indexX * (int)this.dimensions.X, indexY * (int)this.dimensions.Y,
(int)this.dimensions.X, (int)this.dimensions.Y);
}
}
#endregion
on February 6th, 2007 at 12:48 pm
Very strange! when I submit it appears to drop some of the code!
Let’s see if this goes through:
if (index framesAcross * framesDown)
It should read: if index is less than or equal to 0 OR index is greater than framesAcross * framesDown
on February 6th, 2007 at 8:37 pm
Dillinger: “when I submit it appears to drop some of the code”
I have a spam-remover, which puts long posts in a special moderate-this folder.
You can also use some HTML-like codes when posting. When posting C# code, it thinks you are using some of those codes, espcially when thyping less-than and greater-than after each other like you did.
Don’t worry. There’s a forum on the way. You’ll get to post highlighted, indented code there to your heart’s content in just a little while.
Cheers!
Joran
on March 30th, 2007 at 4:05 am
Thank you very much for your tutorials..they are really great ! and one more thing…i dont know if anybody have told you that but your voice is quite relaxing :P:P:P
on August 9th, 2008 at 8:28 am
Hello,
I’m a computer science student in 4th year and I have to say that your videos are great. I skip lots cause I’ve learned some already but most I do listen to. I just wanted to point out that your CalculateScore Method it way more complicated than it need to be.
private Rectangle CalculateSource(int index)
{
if(index
return new Rectangle(0,0,texture.Width,texture.Height);
return new Rectangle(index % 3,index / 3,(int)size.X,(int)size.Y);
}
That does it all right there. Assuming you change the index to be zero based as is the convention in most things.
on March 13th, 2010 at 2:18 pm
разместил на своем народовском сайте ссылку на этот пост. думаю, многим будет интересно!
on March 14th, 2010 at 1:21 pm
разместил на своем народовском сайте ссылку на этот пост. думаю, многим будет интересно!
on March 26th, 2010 at 8:52 pm
Потрясающе! Вот не ожидал…)