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

  1. $trp 100
  2. $eng 005
  3. $msh 070
  4. $rsh 000
  5. $pwr 025
  6. set l 000
  7. set m 000
  8. set n 000
  9. set o 000
  10. # sets up constants u=1000, s=2000, r=30, t=6000, q=90, p=180
  11. set u 100
  12. set a 010
  13. mlt u a
  14. cpy u s
  15. set s 002
  16. mlt s u
  17. set r 030
  18. set t 006
  19. mlt t u
  20. set q 090
  21. set p 180
  22. @loop
  23. set a 003
  24. arm a
  25. set a 040
  26. prx a
  27. set v 002
  28. set w 001
  29. loc
  30. # if range>2000 (max phaser range), goto @lead
  31. bgr a s @lead
  32. # otherwise, phaser it, then fire a torp.
  33. phs
  34. set a 001
  35. arm a
  36. set a 015
  37. prx a
  38. # this next part tries to lead the enemy ship and fire at it
  39. @lead
  40. # this gets the ship's velocity and converts it to x,y,z components
  41. vel
  42. sin b z
  43. cos c x
  44. sin c y
  45. mlt x z
  46. div x u
  47. mlt x a
  48. div x u
  49. mlt y z
  50. div y u
  51. mlt y a
  52. div y u
  53. cos b z
  54. mlt z a
  55. div z u
  56. cpy x g
  57. cpy y h
  58. cpy z i
  59. sub g m
  60. sub h n
  61. sub i o
  62. cpy x m
  63. cpy y n
  64. cpy z o
  65. loc
  66. set j 200
  67. div a j
  68. mlt g a
  69. mlt h a
  70. mlt i a
  71. tim
  72. cpy a j
  73. sub j l
  74. cpy a l
  75. div g j
  76. div h j
  77. div i j
  78. add x g
  79. add y h
  80. add z i
  81. # this part gets the relative position and converts it to X,Y,Z
  82. loc
  83. cpy a k
  84. sin b i
  85. cos c g
  86. sin c h
  87. mlt g i
  88. div g u
  89. mlt g a
  90. div g u
  91. mlt h i
  92. div h u
  93. mlt h a
  94. div h u
  95. cos b i
  96. mlt i a
  97. div i u
  98. # use the formula that X=X0+Vx*T, where X is the position to shoot at, X0 is
  99. # the current position, Vx is the velocity in the X direction, and T is the
  100. # estimated time to reach the target.  Here, I am letting T be Range/600.
  101. # (600 is the torpedo's speed).
  102. set j 100
  103. div a j
  104. set j 006
  105. div a j
  106. mlt x a
  107. mlt y a
  108. mlt z a
  109. add x g
  110. add y h
  111. add z i
  112. # this copies the final results to X, Y, and Z, converts back to polar
  113. # coordinates, fires, and chooses direction.
  114. pol
  115. cpy b y
  116. cpy c z
  117. fir
  118. blt k t @near
  119. # I add 30 degrees to the angle here, to avoid charging the target head on.
  120. set g 150
  121. bgr y g @f2
  122. add y r
  123. set x 100
  124. mve
  125. exe
  126. jmp @loop
  127. @f2
  128. set g 150
  129. add g p
  130. sub g y
  131. cpy g y
  132. add z p
  133. mve
  134. exe
  135. jmp @loop
  136. # keep distance if nearby (r<4000)
  137. @near
  138. blt y r @n2
  139. set x 100
  140. add z p
  141. set g 090
  142. sub g y
  143. cpy g y
  144. add y r
  145. mve
  146. exe
  147. jmp @loop
  148. @n2
  149. set x 100
  150. add y q
  151. sub y r
  152. mve
  153. exe
  154. jmp @loop
  155. $end
  156.  
  157.