Geeks With Blogs
George Clingerman       XNADevelopment.com

thewizardshooting I just finished up the fourth and final part to the Wizard and posted it to my site at XNADevelopment.com. This final installment in the series covers adding the ability to have the Wizard shoot magic fireballs. So creating projectiles and maintaining them it covered in the tutorial.

This has been a fun (but LONG) set of tutorials to write. Let me know what you think of them so I can either continue doing tutorials in this style or adjust them. I'm always happy to hear feedback. Several things I've changed about the tutorials and even about the site layout itself has been from feedback I've received from the community.

Head on over and checkout The Wizard: Part 4 - Making a Sprite Shoot Fireballs and let me know what you think.

Technorati Tags:
Posted on Sunday, March 16, 2008 6:33 PM XNA Development , XNA | Back to top


Comments on this post: XNADevelopment.com - The Wizard: Part Four (2.0)

# Need tutorials on Menu creations
Requesting Gravatar...
hi George,

I am one of those guys who have followed on your articles since you came up with the site(Thank you very much), but left touch of it as there werent any new articles. I am happy to see that you back on track :) I love those tut on 2.0, now that you have taught us how to scroll backgrounds and walk,jump sprites its time now to teach us how to create Menus & how to save game state. it will be very helpful to create a complete game. No Presure George 1 tut at a time :)
Keep up the good work.

Regards,
Claton
Left by Claton Hendricks on Mar 17, 2008 12:51 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Thanks Claton! I really appreciate the comment.

As soon as I'm done with all the re-writes, I'll be sure to add those to the list.

Hopefully by continually building upon previous tutorials we can get close to a full game...we'll just have to see! :)
Left by George Clingerman on Mar 17, 2008 7:24 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I've just discovered your tutorials (and have just gone through the first few), but they have been great. I look forward to seeing what's next!
Left by Scott on Mar 18, 2008 10:44 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Glad to hear you've been enjoying them Scott. Thanks for taking the time say something, I really appreciate it!
Left by George Clingerman on Mar 18, 2008 10:51 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hi, George!

I think your tutorials are great! Congratulations for your work! I'm really learning the basics with them!

Thanks a lot!
Left by Pirola on Mar 20, 2008 8:49 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Great tutorials, they've really gotten me of to a good start learning XNA. I took a few of them and started combining things, like adding the health bar to the wizard tutorial.
Left by Kris on Mar 23, 2008 12:26 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Thanks so much for the help. I had bought a book "XNA Game Programming..." by Wrox and it was hard to understand. However, thanks to you, I can understand what is going on (because I'm a noobie). Keep adding to the site because your an excellent teacher.
Left by Joshua Schell on Mar 26, 2008 7:42 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hey!!

i have tried a few tutorials and had problems with them either not running properly from the next lessons due to slight changes they made, or different versions of XNA,

yours have been simple and effective to learn.

only one thing i noticed as i went thought, on the fireball tutorial you say

"The Update method now needs to start Updating our Fireballs as well. Modify the Update method in the Fireball.cs class to look like the following."

i didnt put it in this class, i put it into the wizard.cs class as i thought that was what you ment. it works fine this way. if that is what you ment then just a heads up :)

if it is for another reason please feel free to email me!

look forward to you future updates!

kind regards
Jon
Left by Jon Cheung on Apr 15, 2008 5:12 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
you tutorials helped me a lot but i think that there is only one thing missing to complete the fireball tutorial or a fifth part for the wizard tutorial would be collision detection, say our wizard hits another wizard with a fireball to cause some damage.
Left by guy on May 14, 2008 11:38 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hi,
Thank you very much for your tutorials.
But I met some problems. When I debugging, the LoadContent function in the Sprite.cs would mention that "NullReferenceException was unhandled"...
I don't know how to solve it, so can you help me?
Thank you very much!
Left by Gino on May 23, 2008 5:33 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I found a problem while testing my code, and it also happens in yours. Try this;
Duck
(while ducking) Shoot a Fireball
Stop Ducking
Try to shoot a fireball, it doesn't work...Its as if the Keyboard.GetState() stops picking up Right Control
Left by Josh on May 23, 2008 9:26 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hi George.

You did a great work on this tutorials but I
Left by Silvio Caetano on May 31, 2008 6:43 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Sorry I hit the wrong key. :(

I want to develop Colision in the Game I thinked in Rectangle Colision that is the easier to learn.
I read some tutorials about it but I'm thinking... where insert the code? In Sprites class?

Need I change much code on original class?

Thanks for your help.
Left by Silvio Caetano on May 31, 2008 6:54 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I want to say a huge THANK YOU for posting these series on basic animation and keyboard control. I now understand much better how to use these concepts in my own programs. Your tutorials are top notch, they explain everything - not just what the code does but why you made the code changes as the Wizard evolved. Thanks again!
Left by Ralph Gutierrez on Sep 11, 2008 2:44 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I have a quick question I followed the entire wizard tutorial series added my own wizard two it and changed it so he faces the direction he is facing I can make him shoot either direction depending on what direction he is facing but he starts out facing right and when I shoot my first fireball no matter wich way im facing it always goes toward the right
Left by Billy on Nov 02, 2008 12:11 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I have gone through most of you tutorials and put most of them together to make a game.

I am making a space shooter type game, right now i have collision dectection between my ship and the enemy ship.....

But i cant figure out a way how to create collision for your fireballs

any help would be great
Left by kyle sullivan on Nov 13, 2008 10:06 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hey George, AWESOME tutoriales, really thanks a lot. Those kind of things help beginners.

I just wanted to tell you that on this tutorial you need to use the:

using System;
using System.Collections.Generic;

statements. Nothing really hard to figure out but maybe you can add it in the tutorial.

BTW I´ve just added you on twitter @hdgam3r ...see you and congratulations.
Left by hdgam3r on Apr 01, 2009 9:36 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
George,

Thanks a ton for these tutorials, I've gone through everything so far up to and through the four-part wizard series.

I'm currently a Game Design student, and these tutorials have helped me grasp game programming!

Once again, thanks a ton :)

All The Best,
Josh
Left by Josh McDonald on Apr 19, 2009 7:10 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Love the tutorials, they are a huge help. I have found loads of tutorials for XNA but all are too specific. I think you could improve your tutorials by doing one on making a title screen or giving the user music controls, that sorta thing. Thanks a bunch!
Left by Sam on May 17, 2009 6:53 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
It seems the fireball sprite cant be found anymore
Left by Modin on Jun 05, 2009 5:48 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hey, George!

I really appreciate these tutorials. I have had an interest in game design for as long as I can remember, and now I'm going to college to become a Game Design major. I feel these walk-throughs have gotten me off to a great start. I completely understand each step, and have added my own things (second Wizard with separate controls so two people could play, the ability to throw fireballs in the last direction that you walked, etc.) which I would have never been able to grasp without your help. If you are going to continue this tutorial series, I would recommend adding part five as collision detection, as it seems to be a very popular request.

Again, thanks for all the help,
Alex
Left by Alex on Jun 18, 2009 9:19 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
This site was just what I was looking for and this tutorial really helped me since i couldnt download from the xna site.

It would be good if we could download the tutorials but im not really bothered. Great tutorial I 'll definately be back.
Left by Jimbo8098 on Oct 31, 2009 1:17 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
thnx man
the tutorials u offer are just what i needed
this will help me a lot
thnx a million
Left by justin on Jan 23, 2010 6:12 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hello George,

Wonderful resource for hobbyist like me, thanks a ton.

Note that in Part 4 the link to the fireball image is broken :(
Left by Emmanuel on Feb 03, 2010 5:40 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
...ah, but I can see it's on the Sprite section of your website! Sorry I didn't spot that earlier :/

Thx again
Left by Emmanuel on Feb 03, 2010 6:07 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Great tutorials George. Got me started with my game project and I really had fun doing so. Wish there was a tutorial for walking animations as well explained as yours are, but I haven't had any luck.

Anyway, thanks for the tuts. Great stuff!
Left by Roderick on May 04, 2010 3:54 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I'm having a couple bugs and runtime errors and I was wondering if anyone could me out.

First, about the ducking animation, when the program starts, the entire sprite sheet is visible, and it only disappears when I duck at least once.

Next, the fireball action simply crashes my program.

I thought I just had some small errors when I was writing the program based on the tutorial, but I tried copying the provided source directly and had the same problems.

Great tutorials though; they really helped me out.

Thanks in advance for any help.
Left by julian on May 24, 2010 9:07 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Object reference not set to an instance of an object.

Im up to this tutorial. I went through all of it, and it all works. I even edited it to work like the game I want it to, so I press Space to fire the fireball. Then when I press enter it does everything right untill it goes to the last load content. then it says "Object reference not set to an instance of an object." when it trys to do "mSpriteTexture = theContentManager.Load<Texture2D>(theAssetName);"

Im pretty sure that ive done everything right, but it still doesnt want to work
Left by Animal on Aug 30, 2010 12:07 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I skiped the two previous tutorials as my sprite didn't need to jump or duck, but I added the "Source" code as I wanted my sprite to shoot.

But now my sprite has a long gray stick coing off it and my fireballs shoot from the middle of that stick, where did I go wrong?

Also when my sprite moves diagonaly I can't seem to fire (only up + left).
Left by Maxxie on Feb 06, 2011 10:15 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hey, I have one question regarding memory? After you create these fireballs, how do you prevent a memory leak caused by simply shooting a bunch of fireballs?
Left by Ryan on Apr 10, 2011 11:03 PM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Lots of ways to handle that Ryan. One way that is normally used is called "resource pooling". A very simple way to do resource pooling is to give the Fireballs an "IsActive" flag and when they hit something or move off the screen set it to fals. Then when you're going to shoot a new fireball, you check through all the existing fireballs to see if there's one that's no longer active that you can re-use.
Left by George Clingerman on Apr 11, 2011 9:05 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
Hey, just wanted to say that these tutorials are great! Also your link to the fireball image is broken, but I got it by dling the project and extracting the fireball.png image. Just letting you know.
Left by PeepQ on May 29, 2012 1:51 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
In this code:

if (aFireball.Visible == false)
{
...
new Vector2(200, 0), new Vector2(1, 0));
// -1, 0 shoots left 1, 0 shoots right
break;
}
}

if (aCreateNew == true)
{
...
new Vector2(200, 200), new Vector2(1, 0));
// -1, 0 shoots left 1, 0 shoots right


i figured out the left and right but i had a couple questions.

1. how do you rotate it when shooting left?

2. when i type (0, 1) or (0, -1) i get a weird reaction. the fireball shoots up but wherever the sprite was it leaves a fireball stamp like it painted the fireball in the background as well as shot it up or down. any suggestions?
Left by Dustin Evans on Jun 27, 2012 3:44 AM

# re: XNADevelopment.com - The Wizard: Part Four (2.0)
Requesting Gravatar...
I have created the basics where we have a player who can move around the screen, i want to add few more background images and make him move around both vertically and horizontally (I learnt how to add images and place it by ur scrolling tutorial, but since it scrolls automatically, i dono how to code for manual scrolling )
Left by V.lakshminarayanan on Oct 24, 2012 11:59 PM

Your comment:
 (will show your gravatar)


Copyright © George Clingerman | Powered by: GeeksWithBlogs.net