MathUtil.cs 623 B

12345678910111213141516171819
  1. //---------------------------------------------------------------------------------
  2. // Ported to the Atomic Game Engine
  3. // Originally written for XNA by Michael Hoffman
  4. // Find the full tutorial at: http://gamedev.tutsplus.com/series/vector-shooter-xna/
  5. //----------------------------------------------------------------------------------
  6. using System;
  7. using AtomicEngine;
  8. namespace AtomicBlaster
  9. {
  10. static class MathUtil
  11. {
  12. public static Vector2 FromPolar(float angle, float magnitude)
  13. {
  14. return magnitude * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
  15. }
  16. }
  17. }