this animation consist 7 picture..
my code for the animation at the game1.cs page:
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
//load char
Animation ca = new Animation();
Texture2D ct = Content.Load<Texture2D>("fighter");
ca.initial(ct, Vector2.Zero, 120, 130, 1, 100, Color.White, 1f, true);
Vector2 cp = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
+ GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
cp = new Vector2(300, 300);
character.initialize(ca, cp);
}
private void updateplayer(GameTime gt)
if (currentks.IsKeyDown(Keys.RightShift))
{
Animation ca = new Animation();
Texture2D ct = Content.Load<Texture2D>("fighter");
ca.initial(ct, Vector2.Zero, 120, 130, 7, 100, Color.White, 1f, true);
Vector2 cp = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
+ GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
character.initialize(ca, cp);
}
from this code..
ca.initial(ct, Vector2.Zero, 120, 130, 7, 100, Color.White, 1f, true);
120 is animation width
130 is animation height
7 is total picture in animation that will be looping
100 is speed looping
it's looping continues.. so if i click right shift, the character continues kick, not stop..
how to make that looping only one times..
thanks..

New Topic/Question
Reply



MultiQuote







|