So tell me what do you want?

Yes finally with enough time I am going to be posting tutorials on how to create a game in XNA.
For simplicity we use XNA 3.0 Beta and Visual C# 2008 Express Edition SP1.
This game will show you how to use sprite sheets, use animated sprites, and do basic collision detection with rectangles.
namespace:Definition: Usually it is your project and where all your code is contained.If your code is not contained in the same namespace then you cannot access the code or classes.
Example
namespace MyNamespace
Okay recently I have been to the XNA Creators Club website while cruising through the forums i noticed there were a few topics about performence issues differences between PC games and Xbox 360 games built with the XNA Framework…So I am going to break it down for you in the simplest way possible.This table displays the most common differences between the two.
| Xbox 360 | PC | |
|---|---|---|
| .Net Framework Type | Compact version(so it isn’t quite as good as the pc version) | Full Version |
| Number of Processors | Three Processors | Anywhere from one to four are common |
| Processor Speed | Runs at 3.2Ghz each | Variable,laptops commonly have 800mhz to 1.5Ghz, where Desktop computers commonly have 1ghz to 4Ghz(that I have seen) |
| Shader Profile(Vertex and Pixel Shader profiles) | custom 3.0 | 1.1 to 4.0 |
| Type of Graphic Card | ATI | Variable,common are Nvidia and ATI |
| Designed for? | Made for Heart pounding hardcore games | Made for general common use. |
It’s important to remember that the garbage collector(or gc) doesnt always run at regular times, so it is important to get rid of those resource hungry objects in a timely matter.
If you use the “XNA Framework remote performance monitor for Xbox 360″ program included witht the xna framework then look for these common things.
Total Garbage Collections
How fast the Garbage collections are happening.
these are the main things to look for.Remember, sometimes it is not the gc though, so run through some test before blaming the gc for the problem.
Here is a article written by Shawn Hargreeves.It also gives some helpful insight about why your games might be running slow on the xbox 360.
Go back to home page
using-Definition1:
used to reference namespaces.These namespaces are often found in seperate DLLs,COM Libraries,or within the very project itsself.
Example: using System.Windows.Forms;
Definition2:Often used with resource hungry objects such as the Pen object or the Brush object,doing so caues the Garbage Collector to dispose of it as soon as possible, Sometimes it can bring about better performance.
Example:
using(Form1 form = new Form1())
{
Application.Run(form);
}
OR
using(Pen pen = new Pen(Color.Black))
{
//Insert your code here that uses the pen object
}
———
Go Back to the Home page..
Paint .NET is a high quality paint program that is made avalible for free.
You can download it here at my virtual drivePaint.NET.3.31.zip or here at the official site
I highly recommend this program if your in need of creating 2d art or editing some textures or images.
Go back to home page
Hello and welcome to one of my tutorials.
Now in this tutorial I am going to show you how to make your sprites(or textures if you want to call them that) transparent. I assume that you at least know the basics of c# and xna.
Lets First add a image to your project.(If you don’t know how to do this then, right click on Content (this can be found in the solution explorer)and then click on add existing, now browse to your image.Select it and click add.).I recommend using a .png image because parts of the image can be transparent with out any code needed. For this example i used a image that I created.If you want to use this image then you can download it from the above link along with the source.
Now in the Game1 class add this code above the constructor.
//For the sprite texture
Texture2D spriteTex;
//For scaling the sprite to fill the screen
Rectangle spriteArea;
//To set the alpha value of the image
//Set it to 255 so we first see the image.
byte alpha = 255;
//Will deterimine if the sprite is fully transparent or not
bool isTransparent = false;
Now put this code in the Initialize() method or the LoadContent() method
spriteArea = new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width,GraphicsDevice.Viewport.Height);
And put this in the LoadContent() method
//Replace the "smile_face" with your own image's asset name
spriteTex = Content.Load("smile_face");
Okay now that our sprite is loaded we can start drawing it now. So in the Draw(GameTime gameTime) method insert this code.
spriteBatch.Begin();
spriteBatch.Draw(spriteTex, spriteArea, new Color(255, 255, 255, alpha));
spriteBatch.End();
alpha--;
If you run the project now you should see your sprite fading out over time. But you’ll also see another problem. Eventually the sprite will sort of pop back up fully non transparent. So lets fix this shall we.
First remove alpha--;(this is below spriteBatch.End();)
Now below the the spriteBatch.End();
add this code:
if (isTransparent == false)
{
if (alpha = 0)
{
//Increment the alpha value by one as long as it is greater than or equal to 0;
alpha++;
}
if (alpha == 255) //IF the alpha value is equal to 255 then we must now decrease it.
{
isTransparent = false;//set the isTransparent to false
//return;//This return is optional
}
}
alpha = (byte)MathHelper.Clamp(alpha, 0, 255);
That should fix the problem now.It is also important to know that the code above(that uses the isTransparent bool) can be put in the update method(which may bring better results).I just felt like putting it in the drawing code.
Below is the full code in case you got lost somewhere and don’t want to download the source project.
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;
namespace OpacityTut
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D spriteTex;
Rectangle spriteArea;
bool isTransparent = false;
byte alpha = 255;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
spriteTex = Content.Load(“smile_face”);
//This code could also go into the initialze method of this class
spriteArea = new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
}
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(spriteTex, spriteArea, new Color(255, 255, 255, alpha));
spriteBatch.End();
if (isTransparent == false)
{
if (alpha = 0)
{
//Increment the alpha value by one as long as it is greater than or equal to 0;
alpha++;
}
if (alpha == 255) //IF the alpha value is equal to 255 then we must now decrease it.
{
isTransparent = false;//set the isTransparent bool to false to decrement the alpha value
//return;//This return is optional
}
}
alpha = (byte)MathHelper.Clamp(alpha, 0, 255);
base.Draw(gameTime);
}
}
}