XNA is a .net language, works with the C# programming language. If you don’t know it, it’s time to start learning.
So I try to give some knowledge about the game development for you.It is very cool and interestind area.But in sri lanka there are only few developers in XNA.In first day we talked about the XNA.
In this week you can learn about the how to manipuate the sprite.
Here is the code..............
Global variables.
float timer = 0f;
float interval = 1000f / 10f;
int frameCount = 10;
int currentFrame = 0;
int spriteWidth;
int spriteHeight;
Rectangle sourceRect;
Rectangle destinationRect;
you should put this code in to Upload method.
float deltaTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
timer += deltaTime;
if (timer > interval)
{
currentFrame++;
if (currentFrame > frameCount - 1)
{
currentFrame = 0;
}
timer = 0f;
}
sourceRect = new Rectangle(currentFrame / 15 * spriteWidth, 0, spriteWidth, spriteHeight);
you can make the sprite as following and save it as a PNG format.
I think you can get some idea about the sprite manipulation from this blog.
Thank You.Good Luck.
The Avatar Movie and Game Trailers
Sunday, January 10, 2010
How To Run The Sprite
Posted by Ex gEn at 6:34 AM 0 comments
Subscribe to:
Comments (Atom)
