public Player() { idle = new Animation( new Vector2( 0, 116 ), new Vector2( 21, 24 ), 16, 9, 0, 0, 0 ); up = new Animation( new Vector2( 31, 146 ), new Vector2( 19, 22 ), 0, 11, 0, 0, 2 ); down = new Animation( new Vector2( 31, 116 ), new Vector2( 19, 22 ), 0, 11, 0, 0, 2 ); right = new Animation( new Vector2( 180, 146 ), new Vector2( 21, 22 ), 0, 11, 0, 0, 2 ); left = new Animation( new Vector2( 210, 116 ), new Vector2( 22, 22 ), 0, 11, 0, 0, 2 ); }
public static void DrawAnimation( SpriteBatch sb, Texture2D spriteSheet, Animation animation, GameTime gt, Vector2 position, Boolean vertical, float animationSpeed ) { animation.elapsed += gt.ElapsedGameTime.TotalSeconds; if( animation.elapsed > animationSpeed ) { if( vertical == false ) { if( animation.numFrames > 0 ) { animation.currentFrame.X += animation.frameSize.X + animation.horizontalSpace; animation.elapsed = 0; ++animation.actualFrame; if( animation.actualFrame >= animation.numFrames ) { animation.actualFrame = 0; animation.currentFrame = animation.firstFrame; } } } else { if( animation.numFrames > 0 ) { animation.currentFrame.Y += animation.frameSize.Y + animation.verticalSpace; animation.elapsed = 0; ++animation.currentRow; ++animation.actualFrame; if( animation.currentRow >= animation.numRows ) { animation.currentRow = 0; animation.actualFrame = 0; animation.currentFrame = animation.firstFrame; } } } } sb.Draw( spriteSheet, new Vector2( position.X, position.Y ), new Rectangle( (int)animation.currentFrame.X, (int)animation.currentFrame.Y, (int)animation.frameSize.X, (int)animation.frameSize.Y ), Color.White ); }
public static void DrawAnimation( SpriteBatch sb, Texture2D spriteSheet, Character character, Animation animation, GameTime gt, float animationSpeed ) { animation.elapsed += gt.ElapsedGameTime.TotalSeconds; if( animation.elapsed > animationSpeed ) { if( animation.numFrames > 0 ) { animation.currentFrame.X += animation.frameSize.X + animation.horizontalSpace; animation.elapsed = 0; ++animation.actualFrame; if( animation.actualFrame >= animation.numFrames ) { animation.actualFrame = 0; animation.currentFrame = animation.firstFrame; } } } sb.Draw( spriteSheet, new Vector2( character.PlayerPosition.X, character.PlayerPosition.Y ), new Rectangle( (int)animation.currentFrame.X, (int)animation.currentFrame.Y, (int)animation.frameSize.X, (int)animation.frameSize.Y ), Color.White ); }
public Explosion( Vector2 position ) { BomberMan.explosions.Add( this ); this.position = position; flameMiddle = new Animation( new Vector2( 60, 30 ), new Vector2( 16, 16 ), 0, 74, 0, 0, 4 ); flameLeft = new Animation( new Vector2( 28, 30 ), new Vector2( 16, 16 ), 0, 74, 0, 0, 4 ); flameRight = new Animation( new Vector2( 92, 30 ), new Vector2( 16, 16 ), 0, 73, 0, 0, 4 ); flameUp = new Animation( new Vector2( 60, 0 ), new Vector2( 16, 14 ), 0, 0, 74, 0, 4 ); positionLeft = new Vector2( position.X - flameMiddle.frameSize.X, position.Y ); positionRight = new Vector2( position.X + flameMiddle.frameSize.X - 1, position.Y ); lefMiddle.X = positionLeft.X + 8; lefMiddle.Y = positionLeft.Y + 8; middleMiddle.X = position.X + 8; middleMiddle.Y = position.Y + 8; rightMiddle.Y = positionRight.Y + 8; rightMiddle.X = positionRight.X + 8; }
public Animator( SpriteBatch sb, Animation animation, string animationName ) { this.sb = sb; animations.Add( (object)animationName, animation ); }
public Bomb( Character owner ) { this.owner = owner; timer = new Animation( new Vector2( 0, 0 ), new Vector2( 17, 16 ), 14, 0, 2, 0, 2 ); explosion = new Animation(); }
public Animator(SpriteBatch sb, Animation animation, string animationName) { this.sb = sb; animations.Add((object)animationName, animation); }