home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / game / misc / 003 / mighty2.src < prev    next >
Encoding:
Text File  |  1993-05-03  |  1.8 KB  |  121 lines

  1. #configure ship
  2. $trp 100
  3. $eng 005
  4. $msh 095
  5. $rsh 100
  6. $pwr 100
  7. set a 010
  8. arm a
  9. set a 040
  10. prx a
  11. # sets up constants m=1000, n=100, s=2000, p=40, r=30, o=1, q=0, t=5
  12. set m 100
  13. set a 010
  14. mlt m a
  15. set n 100
  16. cpy m s
  17. set p 002
  18. mlt s p
  19. set p 040
  20. set r 030
  21. set o 001
  22. set q 000
  23. set t 005
  24. @loop1
  25. #finds southernmost enemy ship (-z)
  26. set f 001
  27. set g 000
  28. set v 002
  29. set w 001
  30. @lp1
  31. loc
  32. bne w o @tmp1
  33. cpy b g
  34. @tmp1
  35. blt b g @in1
  36. cpy w f
  37. cpy b g
  38. @in1
  39. add w o
  40. dam
  41. blt a n @lp1
  42. cpy f w
  43. @targeting
  44. loc
  45. # if range>2000 (max phaser range), goto @lead
  46. bgr a s @lead
  47. # otherwise, phaser it, select movement direction, and goto @mvt
  48. phs
  49. cpy b y
  50. cpy c z
  51. cpy p x
  52. jmp @mvt
  53. # this next part tries to lead the enemy ship and fire at it
  54. @lead
  55. # this gets the ship's velocity and converts it to x,y,z components
  56. vel
  57. sin b i
  58. cos c g
  59. sin c h
  60. mlt g i
  61. div g m
  62. mlt g a
  63. div g m
  64. mlt h i
  65. div h m
  66. mlt h a
  67. div h m
  68. cos b i
  69. mlt i a
  70. div i m
  71. # this part gets the relative position and converts it to X,Y,Z
  72. loc
  73. sin b l
  74. cos c j
  75. sin c k
  76. mlt j l
  77. div j m
  78. mlt j a
  79. div j m
  80. mlt k l
  81. div k m
  82. mlt k a
  83. div k m
  84. cos b l
  85. mlt l a
  86. div l m
  87. # use the formula that X=X0+Vx*T, where X is the position to shoot at, X0 is
  88. # the current position, Vx is the velocity in the X direction, and T is the
  89. # estimated time to reach the target.  Here, I am letting T be Range/250.
  90. # (250 is the torpedo's speed).
  91. cpy a t
  92. set u 100
  93. div t u
  94. set u 006
  95. div t u
  96. mlt g t
  97. mlt h t
  98. mlt i t
  99. add g j
  100. add h k
  101. add i l
  102. # this copies the final results to X, Y, and Z, converts back to polar
  103. # coordinates, fires, and chooses direction.
  104. cpy g x
  105. cpy h y
  106. cpy i z
  107. pol
  108. cpy b y
  109. cpy c z
  110. fir
  111. # I add 30 degrees to the angle here, to avoid charging the target head on.
  112. add z r
  113. cpy n x
  114. @mvt
  115. # here we move
  116. mve
  117. exe
  118. jmp @loop1
  119. $end
  120.