public Unit_Animated_Explosion(Game game, SpriteBatch spriteBatch, Unit_Enemy sourceEnemy) : base(game, spriteBatch) { int xFrames = 12; int xFps = 60; icon = content.Load<Texture2D>("Explosion"); animationSettings = new AnimationSettings(icon.Width / xFrames, icon.Height, xFrames, xFps, true); currentFrameIndex = 1; prevFrameTime = TimeSpan.Zero; frameTime = TimeSpan.FromSeconds((double)xFrames / (double)xFps); // center on source enemy position.X = (sourceEnemy.Position.X + sourceEnemy.Width / 2) - Width / 2; position.Y = (sourceEnemy.Position.Y + sourceEnemy.Height / 2) - Height / 2; }
public Unit_Animated_Explosion(Game game, SpriteBatch spriteBatch, Unit_Enemy sourceEnemy) : base(game, spriteBatch) { int xFrames = 12; int xFps = 60; icon = content.Load <Texture2D>("Explosion"); animationSettings = new AnimationSettings(icon.Width / xFrames, icon.Height, xFrames, xFps, true); currentFrameIndex = 1; prevFrameTime = TimeSpan.Zero; frameTime = TimeSpan.FromSeconds((double)xFrames / (double)xFps); // center on source enemy position.X = (sourceEnemy.Position.X + sourceEnemy.Width / 2) - Width / 2; position.Y = (sourceEnemy.Position.Y + sourceEnemy.Height / 2) - Height / 2; }
public Unit_Animated_Player(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { int xFrames = 3; int xFps = 15; icon = content.Load<Texture2D>("Player"); animationSettings = new AnimationSettings(icon.Width / xFrames, icon.Height / yFrames, xFrames, xFps, false); currentFrameIndex = 1; prevFrameTime = TimeSpan.Zero; frameTime = TimeSpan.FromSeconds((double)xFrames / (double)xFps); yCurrentFrameIndex = 1; yPrevFrameTime = TimeSpan.Zero; yFrameTime = TimeSpan.FromSeconds((double)yFrames / (double)yFps); health = Settings.Player_Health; position = new Vector2((Settings.Viewport.Width - Width) / 2, (Settings.Viewport.Height - (Height + Settings.Player_Offset))); speed = Settings.Player_Speed; }
public Unit_Animated_Player(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { int xFrames = 3; int xFps = 15; icon = content.Load <Texture2D>("Player"); animationSettings = new AnimationSettings(icon.Width / xFrames, icon.Height / yFrames, xFrames, xFps, false); currentFrameIndex = 1; prevFrameTime = TimeSpan.Zero; frameTime = TimeSpan.FromSeconds((double)xFrames / (double)xFps); yCurrentFrameIndex = 1; yPrevFrameTime = TimeSpan.Zero; yFrameTime = TimeSpan.FromSeconds((double)yFrames / (double)yFps); health = Settings.Player_Health; position = new Vector2((Settings.Viewport.Width - Width) / 2, (Settings.Viewport.Height - (Height + Settings.Player_Offset))); speed = Settings.Player_Speed; }