George Clingerman

      XNADevelopment.com
posts - 188, comments - 1510, trackbacks - 181

My Links

News



Twitter












Tag Cloud

Article Categories

Archives

Post Categories

. XNADevelopment.com .

XNADevelopment.com - Creating a 2D Sprite (2.0)

firstsprite I have completely re-written the tutorial covering creating a 2D sprite and posted it to my site at XNADevelopment.com. I'm much happier with it this time around. This tutorial covers displaying your first sprite on the screen and then positioning the sprite. The tutorial then takes you a step further and helps you get accustomed to object oriented development and walks you through creating a "Sprite" class for creating and drawing your sprites on the screen. Teaching you a fundamental step you will take throughout your game development process.

Go ahead and take a quick walk through on Creating a 2D Sprite.

These tutorials take time to create, so if you've benefited from them, let me know and take the time to leave a comment. I appreciate each and every comment and bit of feedback I get. Thanks for taking the time to show your appreciation.

Technorati Tags:
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Friday, March 07, 2008 6:42 PM | Filed Under [ XNA Development XNA ]

Feedback

Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Excellent tutorial. My first time on XNA, and C# [I know C++ though] and it makes perfect sense and explains why I'm doing what I'm doing instead of just blindly pasting lines in. Thank you very much :)
3/13/2008 9:07 PM | Spoon
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

This has helped me out a lot, excellent tutorial please keep them coming.
3/16/2008 4:04 PM | Rob
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

@Spoon - Thanks! I appreciate the comment. Makes me feel like it's worth the time I put into them.
3/17/2008 7:33 AM | George Clingerman
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

@Rob - Glad to hear they're helping! Thanks a lot for taking the time to let me know. I really appreciate it.
3/17/2008 7:33 AM | George Clingerman
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hey Thank you so much George this is massive help!

3/18/2008 7:46 PM | Sal
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hey George, i LOVE these tutorials they are great help, please keep more coming!!!!!!!! Maybe some platform collisions, gravity, all types of tutorials. They are GREAT please keep more coming for 2.0!
3/20/2008 8:34 PM | Cameron
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

hello, it was such a beautiful website for beginners.I Thank you a lot for rendering such a wonderful website for the beginners like us.
3/23/2008 10:11 PM | subramanya
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hi,

In the "Creating a 2D Sprite - Drawing your first sprites to the screen" if you want to use the ContentManager in the LoadContent method in the Sprite class, you need to add

using Microsoft.Xna.Framework.Content;

ps: nice tutorials :)
4/13/2008 7:16 AM | Pedro Luz
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hi,
very nice & easy tutorials
just what i'm looking for

thanks :)
5/9/2008 1:05 PM | Dome F
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hi,

Its great... thanks for help us...

:)
5/11/2008 9:12 PM | Ricardo
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hi there i have a bit of a problem you said add
Vector2 mPosition = new Vector2(0,0)
Texture2D mSpriteTexture;
at the top is this correct

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

// dont know if this is right
Vector2 mPosition = new Vector2(0,0);
Texture2D mSpriteTexture;


namespace MyFirstGame
{
could you let us know i get the errors which are related to those two bits as follows:
Error 1 A namespace does not directly contain members such as fields or methods C:\XNA Games\MyFirstGame\MyFirstGame\Game1.cs 13 1 MyFirstGame

Error 2 Expected class, delegate, enum, interface, or struct C:\XNA Games\MyFirstGame\MyFirstGame\Game1.cs 13 25 MyFirstGame
my work email is david.williams@elliott-algeco.com

cheers guys


5/18/2008 11:06 AM | David Williams
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Neat stuff .. was going thru an Apress book.. but i stumbled upon this method meself, thnx to u, got it confirmed :D
7/4/2008 10:35 AM | Carlyle Oliver
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Great stuff! I've only programmed a bit in C before so this is a good transition for me and im looking forward to getting on with the Wizard tutorials next!
7/28/2008 4:16 PM | Peanut
Gravatar

# Hi, an error I spotted

You have a call to base.Update(), but Update is not declared in your sprites.cs class.
8/3/2008 3:08 PM | Quentyn
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

@mike:

you can do this by instantiating an array of your ObjectType with size of 40. You could then create a for loop to loop through each element and draw it to the screen. It's all about taking your pre-existing C#/Programming knowledge, and applying it to his examples to do the things you want to do.
8/3/2008 3:10 PM | Quentyn
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Sorry for triple posting(no edit button)

@mike:

im pretty sure there's a function in C# somewhere for you to obtain a random number. once again, take your knowledge of the language, and apply it to your new knowledge of CSharp, and you can do some cool things.
8/3/2008 3:12 PM | Quentyn
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

@David Williams:

He said to add it to the top of your class. The reason you're getting erros is because you're using entities which do not yet exist. Entities you want to use (such as Vector2 or Texture2D) must come after the using statement in which they exist, and should exists within the class level of the class you want to use them in.
8/3/2008 3:16 PM | Quentyn
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Thank you so much for the Examples. I have learned more from your teaching then reading some of the XNA books out there.
8/8/2008 2:09 AM | Attila
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

finally a good tutorial that shows you the basics of making a game, thanks george!!!
8/13/2008 2:01 AM | bubbleshield
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Interesting article. Very good thanks.

I've finsihed and released my game on the gp2x. I'm now considering a port onto the Xbox 360 XNA C#.

Your article gave me a good taster of the actual code.

Regards, Jamie
8/13/2008 6:37 AM | Jamie Lutzuver
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX THNX ALOT
8/22/2008 9:14 PM | Zealot
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

hey nice tutorials george. I ran into a little problem though.

//create a new Spriteach, which can be used to draw textures
spriteBatch = new SpriteBatch(GraphicsDevice);

it says that i was using GraphicsDevice as a variable but its a type. Ive done some XNA before mainly 1.0 so i knew that i had to put graphics.GraphicsDevice to fix it. Not sure if anyone else has had a problem with this, but i did. Nice tutorials and i really like them. Thank you
8/30/2008 5:47 PM | Bryan
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Thank you so much. Your tutorials are great!!
10/13/2008 10:20 PM | Edel
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

excellent tutorials
1/27/2009 1:21 AM | cl
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I think this is a very cool tutorial. I have been reviewing the XNA Creators Club tutorials and they are boring and very explicit. I dont like that. Thank you very much for creating this tutorial. :)
4/11/2009 4:03 PM | Israel Segundo
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Very nice tutorial, thanks for sharing.
4/19/2009 10:12 AM | live cams treff
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

This is an excellent tutorial. nice posting
8/10/2009 3:20 AM | no fax payday loans
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Great work, keep posting good tutorial like this. Thanks
8/10/2009 3:21 AM | cefcu
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I am using 2D for some graphics. This is a good tutorial . thank you
8/14/2009 9:25 AM | top travel destinations
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

This is a great tutorial, nice work. Thank you very much
8/14/2009 9:27 AM | Electric Cars
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Yes you make a very good job, I read some of your happy and you learned a lot, thank you.
8/20/2009 4:38 AM | radiateur inertie
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Good work! You are the best !!!
8/28/2009 7:51 AM | voyance gratuite
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Why not ?
10/21/2009 7:45 AM | pari sportif
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Excellent website, thanks for the information.
12/8/2009 4:36 PM | bwin fr
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I agree with you.
12/8/2009 4:41 PM | site de paris en ligne
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

When I put this code in I get an error saying the name 'Position' does not exist in the current context. I have no idea why it's doing this. Help pleaseeee
//Draw the sprite to the screen
public void Draw(SpriteBatch theSpriteBatch)
{
theSpriteBatch.Draw(mSpriteTexture, Position, Color.White);
}

7/4/2010 7:49 PM | Kriptic
Gravatar

# Development

The information here fits my query. I was searching for a specific site that would best suit my research. I came up here and got to know more details. So far this has enough information. I would like to track your future post related to the said article posted here. Thank you.
8/6/2010 3:56 AM | Lovely Lois
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Good work! great article, thnks a lot
8/6/2010 6:07 AM | annonces gratuites
Gravatar

# Helpful

Although it was a little too long to make but it was good and I found it very helpful especially for a beginner like me. Keep us updated for your new developments and news.





Diamond Engagement Rings
8/27/2010 9:30 PM | Harry Winston
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

your website is really informative i like read it!
8/29/2010 5:14 PM | jouer casino
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

your stuff is very good i like it!
8/30/2010 11:27 AM | roulette en ligne
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

on: public void LoadContent.....

I get an error that "void" is an expected class,delegate,enum,interface, or strct.

any help?
9/6/2010 3:55 PM | joe
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

your site is good thanks!
9/16/2010 1:06 PM | pronostic sportif
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I LOVE THIS ENTIRE SITE!! THANK U SO MUCH FOR THIS TUTORIAL!!
2/26/2011 7:19 PM | Mobin Skaria
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Clean website. Do you ever accept guest posts? I am maintaining a site on my latest hobby water filters and wanting to trade some content with good sites. I looked around your blog and you’ve got some good content and I was thinking our readers would both find value. Thanks!.
4/11/2011 3:23 AM | cell phone spyware
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

So, all that you have to do is select the TGA files to use and let Sprite Page Creator take care of the rest. So, if your looking for a image sequence compiler take this tool for a spin and see if its capabilities are enough to satisfy your needs.........
5/5/2011 1:59 AM | cell phone spyware
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Hi there! I really love your articles. Very well written. I look forward to reading more. Thanks for share with us.
5/13/2011 10:46 PM | Mobile Spy
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Excellent post.The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.
5/16/2011 7:51 AM | anemia homeopathic
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

This is one excellent tutorial, too. I like your blog. Everything is so informative here. Keep up the good work. Age of War 2
5/21/2011 5:17 AM | Age of War 2
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Nice tutorial. You presented everything in a clear and easy-to-understand manners. I was able to learn a lot from you. Physics Games
5/23/2011 12:12 AM | Physics Games
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Thanks for posting such an informative tutorial that is also easy to understand. I hope to read more of these. Keep up the good work. Web Designers in Toronto
5/23/2011 12:14 AM | Web Designers in Toronto
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

For some cause only one-half of the post is being shown. Is this my browser causing it or can it be the web site?
5/24/2011 6:12 AM | wholesale playing cards
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I would like to thank you for the pains you have made in writing this article. I am hopeful the same best work from you in the hope as well.
5/26/2011 4:43 AM | san francisco giants tickets
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

thank you for the post. it is very informative but my head quite aching understanding it. thanks for the tutorial.Second Hand Golf Clubs
6/11/2011 9:52 AM | Second Hand Golf Clubs
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I have completely re-written the tutorial covering creating a 2D sprite and posted it to my site at XNADevelopment.com.
6/21/2011 6:23 AM | Mercato
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

very informative
6/28/2011 8:49 AM | Promat
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I simply stumbled upon your blog and wished to say that I’ve really enjoyed browsing your blog posts. In any case I will be subscribing in your rss feed and I hope you write once more very soon!
Home Automation

Gourmet Gift Baskets
7/7/2011 6:52 AM | hamant
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I never knew that creating 2D Sprite could be this easy. Thanks for a clearly-written tutorial on this one. It really shows that you know your craft really well.
JogoDeMoto
7/16/2011 2:50 AM | JogoDeMoto
Gravatar

# great

Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it.
flowers delivery thailand | turkey florist
7/16/2011 6:17 AM | lindamartin
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

This is one of the good articles you can find in the net explaining everything in detail regarding the topic. I thank you for taking your time sharing your thoughts and ideas to a lot of readers out there. used car search
7/21/2011 1:48 AM | used car values
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I needed in order to thanks with this superb study!! We certainly cherished each and every little this. Regards for that data!!!! & This is actually the ideal weblog for anybody who would like to learn about this particular subject. You realize a lot it's nearly difficult in order to dispute along with you.........

clubmz e-spy
7/22/2011 11:44 PM | loria jacob
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I am very excited that I have found your post because I have been searching for some information about it for almost three hours. You have helped me a lot and reading this your article I have found much new and useful information about this subject.

ways to stop snoring
7/23/2011 12:48 AM | Guest998
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

Interesting post and thanks for sharing. Some things in here I have not thought about before.Thanks for making such a cool post which is really very well written.
Fluoxetine Side Effects
7/27/2011 2:31 PM | hammaa
Gravatar

# klavier kurs online und gasgrill kaufen

klavier lernen und frei spielen lernen sowie günstige gasgrills kaufen klavier frei spielen | günstige gasgrills
7/30/2011 10:36 AM | gasgrill kaufen
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I understand how to do it... it is really easy. thanks! cialis online
8/5/2011 3:22 AM | dani
Gravatar

# Mr

I have been through the whole content of this blog which is very informative and knowledgeable stuff, So i would like to visit again. how to get rid of skin tags
8/30/2011 11:58 PM | Victor Rouff
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

very good story
9/13/2011 4:19 PM | rugby
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

good tutorial
9/13/2011 4:20 PM | direct football
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I really like the content in your post. .. thanks for sharing it to us . . .really much appreciated. .
10/25/2011 5:57 AM | cell monitoring
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

is that a game you've created?. . .I think it is cool . .thanks for sharing it to us . . .really great post. . .
10/25/2011 5:59 AM | cell phone tracker software
Gravatar

# To the theme

I guess 3D one is already in use
10/31/2011 12:28 PM | casino en ligne francais
Gravatar

# re: XNADevelopment.com - Creating a 2D Sprite (2.0)

I understand how to do it... it is really easy. thanks!
1/30/2012 4:37 PM | casino
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: