//TimeSpan SpawnTime, ShootTime; public void Initialize(SniperEnemyAnimation animation, Vector2 position, Vector2 target) { // Set the position of the enemy SniperAnimation = animation; Position = position; // We initialize the enemy to be active so it will be update in the game Active = true; // Set the health of the enemy Health = 25; // Set the amount of damage the enemy can do //Very Weak Damage = 100; // Set how fast the enemy moves //Direction = direction; // Set the score value of the enemy //More value due to more danger Value = 150; }
private void AddSniperEnemy(GameTime gameTime) { Random SniperRandom = new Random(); SniperEnemyAnimation sniperEnemyAnimation = new SniperEnemyAnimation(); TimeSpan SpawnTime = gameTime.TotalGameTime; sniperEnemyAnimation.Initialize(sniperTexture, 0, 50, 50); Vector2 position = new Vector2(random.Next(100, GraphicsDevice.Viewport.Width - 50), random.Next(100, GraphicsDevice.Viewport.Height - 50)); Vector2 target = new Vector2 (SniperRandom.Next(0,1000), SniperRandom.Next(0,800)); SniperEnemy sniperEnemy = new SniperEnemy(); sniperEnemy.Initialize(sniperEnemyAnimation, position, target); sniperEnemies.Add(sniperEnemy); }