public Vector2 GetProjectilePosition(float time, float groundY) { float hitXPosition = GetPlayerRightEdgeXByTime(time); float startingXPosition = GeneralValues.MusicStartPositionX + hitXPosition + time * PhysicsValues.GetProjectileVelocity() + (PhysicsValues.ProjectileHitboxWidth / 2.0f); float startingYPosition = groundY + LevelGenerationValues.GetProjectileYOffset(); return(new Vector2(startingXPosition, startingYPosition)); }
private void DeflectProjectile(Projectile projectile) { float yVelocity = MyMath.GetRandomNumber() * PhysicsValues.ProjectileMaximumYVelocity; if (MyMath.GetRandomNumber() > 0.5f) { yVelocity *= -1; } float xVelocity = (float)Math.Sqrt(Math.Pow(PhysicsValues.GetProjectileVelocity() * 3, 2) - Math.Pow(yVelocity, 2)); Vector2 deflectionDirection = new Vector2(xVelocity, yVelocity); GetLevelProgression().DeflectProjectile(projectile, deflectionDirection); }