Sorceress

pong0000

Sep 12th, 2020 (edited)
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'DGC Code Pong : Untitled Elite-like
  2. 'ver 0000 : 2020-09-13
  3.  
  4. '--- Definitions ------------------------------------------
  5. CONST kPi = 3.14159265
  6. CONST kPi2 = 6.28318531
  7. CONST kDiv3 = 0.333333333
  8. CONST kRoot2 = 1.414213562
  9. CONST kDivRoot2 = 0.7071067812
  10.  
  11. TYPE tVec3
  12. x AS SINGLE
  13. y AS SINGLE
  14. z AS SINGLE
  15. END TYPE
  16.  
  17. TYPE tStar
  18. p AS tVec3 'Position
  19. END TYPE
  20. DIM star(511) AS tStar
  21. DIM stars AS LONG
  22.  
  23. '--- Main -------------------------------------------------
  24. SCREEN 13: cX = 160: cY = 100 'Centres
  25. stars = 511: GOSUB GenGalaxy
  26. DO
  27. a1 = a1 + 0.01
  28. a2 = COS(a1 / 3) ^ 2
  29. CLS
  30. FOR i = 1 TO stars
  31. pX = star(i).p.x
  32. pY = star(i).p.y
  33. pZ = star(i).p.z
  34.  
  35. pX1 = pX * COS(a1) - pY * SIN(a1)
  36. pY = pX * SIN(a1) + pY * COS(a1)
  37. pX = pX1
  38.  
  39. pZ1 = pZ * COS(a2) - pY * SIN(a2)
  40. pY = pZ * SIN(a2) + pY * COS(a2)
  41. pZ = pZ1
  42.  
  43. PSET (cX + pX, cY + pZ)
  44. NEXT
  45. _DISPLAY
  46. _LIMIT 60
  47. LOOP
  48. SLEEP
  49. SYSTEM
  50.  
  51. '--- Subs -------------------------------------------------
  52. GenGalaxy:
  53. r = 85 'Galactic Radius
  54. FOR i = 1 TO stars
  55. a = (RND * 2 + RND) / 3
  56. b = kPi2 * RND: b = b + COS(2 * b) - 6 * a
  57. c = (2 * RND - 1) / (3 + 30 * a)
  58.  
  59. star(i).p.x = r * a * COS(b)
  60. star(i).p.y = r * a * SIN(b)
  61. star(i).p.z = r * c
  62. NEXT
  63. RETURN
  64.  
  65.  
  66.  
RAW Paste Data