public Bullet(Texture2D newTexture, Player player, float newRotation) : base(newTexture) { alive = true; rectangle.X = player.rectangle.Center.X - rectangle.Width / 2; rectangle.Y = player.rectangle.Center.Y; rotation = toRadians(newRotation); }
public void checkPlayerCollision(Player player) { if (player.rectangle.Intersects(rectangle) && player.rectangle.Top >= rectangle.Center.Y && velocity.Y > 0) { rotation = toRadians((float)((player.rectangle.Center.X - rectangle.Center.X) / 1.1f * (-1))); setVelocity(rotation); velocity.Y *= (-1); Game.bounceSound.Play(0.5f, 0, 0); } }