private void Shootprojectile(GameTime gameTime) { shootingDelay = .5; float projectileSpeed = 400; Vector2 playerCenter = new Vector2(_player._position.X - _player.Source.Width / 2, _player._position.Y + (_player.Source.Height / 2)); Vector2 projectileCenter = new Vector2(_position.X + Source.Width / 2, _position.Y + Source.Height / 2); Vector2 attackVector = playerCenter - projectileCenter; attackVector.Normalize(); if (_projectiles.Count <= 20) { if (_currentState != State.Stunned) { Projectile projectile = new Projectile(); _projectiles.Add(projectile); projectile.LoadContent(_contentManager, "hadouken", 10); projectile.Fire(_position + new Vector2(_size.Width / 2, _size.Height / 2), new Vector2(projectileSpeed, projectileSpeed), attackVector); } } }
private void Shootprojectile(GameTime gameTime) { shootingDelay = .5; float projectileSpeed = 400; Vector2 attackVector = _playerPosition - _position; attackVector.Normalize(); if (_projectiles.Count <= 20) { if (_currentState == State.Walking) { Projectile projectile = new Projectile(); _projectiles.Add(projectile); projectile.LoadContent(_contentManager, "hadouken"); projectile.Fire(_position + new Vector2(_size.Width / 2, _size.Height / 2), new Vector2(projectileSpeed, projectileSpeed), attackVector); } } }