tempest.bmx 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469
  1. 'Tempest
  2. 'Started by David Bird (Birdie) - BlitzMax 1.10 Samples
  3. 'Completed by Mark Incitti (Mark1nc) - June 2005
  4. ' Version 1.5 - July 18
  5. ' added 16 more tubes
  6. ' tweaked the difficulty and release rates
  7. ' Version 1.1 - July 7
  8. ' fixed egg hatching to act 7 (non-existant case - disappeared)
  9. ' changed fuseballs - only kill when off the edge w>1 or w<7
  10. ' added Tempest Tubes boards
  11. ' CTRL - Fire!
  12. ' SPACE - Superzapper
  13. ' L/R - Move
  14. ' ESC - Quit
  15. ' T - select tube set
  16. Strict
  17. Import "transformfunctions.bmx"
  18. Import "vectorfont.bmx"
  19. Import "sfx.bmx"
  20. 'Setup Graphics mode
  21. Graphics CWidth,CHeight,32 ',0 windowed ',32 'fullscreen
  22. HideMouse
  23. SeedRnd(MilliSecs())
  24. 'defined colours index
  25. Const COL_BULLETS = 0
  26. Const COL_CLAW = 1
  27. Const COL_TANKERS = 2
  28. Const COL_FLIPPERS = 3
  29. Const COL_PULSARS = 4
  30. Const COL_SPIKERS = 5
  31. Const COL_LEVEL = 6
  32. Const COL_INFO = 7
  33. 'death types
  34. Const KILLED_BY_BULLET = 0
  35. Const KILLED_BY_PULSAR = 2
  36. Const KILLED_BY_SPIKE = 3
  37. Const KILLED_BY_FLIPPER = 4
  38. Const KILLED_BY_FUSEBALL = 5
  39. 'level states
  40. Const LEVEL_BEGIN = 0
  41. Const LEVEL_COMPLETE = 1
  42. Const LEVEL_READY = 2
  43. Const LEVEL_PLAYER_DYING = 3
  44. Const LEVEL_ZOOMING = 4
  45. Const LEVEL_START_ZOOM = 5
  46. Const LEVEL_REVERSE_ZOOM = 6
  47. Const LEVEL_INTO_VORTEX = 7
  48. 'baddie types
  49. Const BAD_SPIKE = 1
  50. Const BAD_BULLET = -1
  51. Const BAD_SPINNER = 2
  52. Const BAD_FLIPPER = 3
  53. Const BAD_TANKER = 4
  54. Const BAD_PULSAR = 5
  55. Const BAD_FUSEBALL = 6
  56. Const PLAYERSPEED# = 0.25 '5 positions per edge 0,.25,.5,.75,1
  57. ' lists of objects
  58. Global POINT_LIST:TList = New TList
  59. Global FUSEPOINT_LIST:TList = New TList
  60. Global EGG_LIST:TList = New TList
  61. Global EXPLOSION_LIST:TList = New TList
  62. Global SHOT_LIST:TList = New TList
  63. Global BADDIE_LIST:TList = New TList
  64. Global theLevel:Level
  65. Global current_level = 0
  66. Global current_color = 0
  67. Global current_board = 0
  68. Global tubes = 0
  69. Global hiscore = 0
  70. Global leveldata[64,3+32] ' Closed/Open, YCenter, YOFFSET, 16 x,y pairs
  71. Global eggsleft
  72. Global maxeggs
  73. Global enemiesleft
  74. Global hatchingeggs
  75. Global MainPlayer:Player
  76. Global superzapper = 2
  77. Global superzapperdisplay = 0
  78. Global startbonus = 0
  79. Global zapchan:TChannel = AllocChannel()
  80. Global canflip = True
  81. Global flipflipspeed = 15
  82. Global pulseflipspeed = 15
  83. Global fuseclimbspeed = 1
  84. Global tankerclimbspeed = 1
  85. Global pulsecount = 0
  86. Global pulsespeed = 1
  87. Global pulsing = False
  88. Global pulse_zh#
  89. Global pulsesalive = False
  90. Global fusex#[5,6,7]
  91. Global fusey#[5,6,7]
  92. Global fuseball_count
  93. Global fuseball_frame
  94. Global globalclock
  95. Global enemyreleaserate = 30
  96. Global hatchrate = 1
  97. Global rimit = False
  98. Global onrim = False
  99. Global showdebug
  100. LoadSfx()
  101. ReadFuseballData()
  102. ReadLevelData()
  103. theLevel = Level.Create()
  104. MainPlayer = Player.Create()
  105. Game()
  106. 'BoardMaker()
  107. Function BoardMaker()
  108. Local showcord = False
  109. Local index = 0
  110. Local cb = 0
  111. Local xp[16]
  112. Local yp[16]
  113. Local c
  114. While Not KeyHit(key_escape)
  115. c = leveldata[cb,0]
  116. k = 70
  117. CCenterY = leveldata[cb,1]
  118. YOFFSET = leveldata[cb,2]
  119. For Local a = 0 Until 16
  120. xp[a] = leveldata[cb,3+a*2]+400
  121. yp[a] = leveldata[cb,3+a*2+1]+300
  122. If index = a
  123. DrawOval xp[a]-4,yp[a]-4,8,8
  124. Else
  125. DrawOval xp[a]-2,yp[a]-2,4,4
  126. EndIf
  127. If a > 0
  128. DrawLine xp[a-1],yp[a-1],xp[a],yp[a]
  129. EndIf
  130. If showcord Then DrawText "("+(xp[a]-400)+","+(yp[a]-300)+")",xp[a]-30,yp[a]-20
  131. Next
  132. If c
  133. DrawLine xp[15],yp[15],xp[0],yp[0]
  134. EndIf
  135. If KeyHit(key_c) Then showcord = 1-showcord
  136. If KeyHit(key_b) Then cb = cb + 1 ; If cb > 47 Then cb = 0
  137. If KeyHit(key_v) Then cb = cb - 1 ; If cb < 0 Then cb = 47
  138. If KeyHit(key_COMMA) Then index = index - 1;If index < 0 Then index = 15
  139. If KeyHit(key_PERIOD) Then index = index + 1;If index > 15 Then index = 0
  140. If KeyHit(key_left) Then leveldata[cb,3+index*2]:-10
  141. If KeyHit(key_right) Then leveldata[cb,3+index*2]:+10
  142. If KeyHit(key_up) Then leveldata[cb,3+index*2+1]:-10
  143. If KeyHit(key_down) Then leveldata[cb,3+index*2+1]:+10
  144. DrawText cb,10,10
  145. If KeyHit(key_s)
  146. DebugLog "'Level "+cb
  147. Local s$ = "DefData "+c+","+leveldata[cb,1]+","+leveldata[cb,2]+","
  148. For Local a = 0 Until 16
  149. s$ = s$ + Int(leveldata[cb,3+a*2]) +","+ Int(leveldata[cb,3+a*2+1])
  150. If a < 15 Then s$=s$+","
  151. Next
  152. DebugLog s$
  153. EndIf
  154. Flip
  155. Delay 30
  156. Cls
  157. Wend
  158. End Function
  159. Type Player
  160. Field e_Index 'the edge the player is on
  161. Field zPos ' player height
  162. Field shottimer = 3 ' delay between shots timer
  163. Field score
  164. Field oldscore
  165. Field bonusmencnt = 0 ' keep track of when bonus man is due
  166. Field dying
  167. Field men = 3
  168. Field deathcount
  169. Field deathtype
  170. Field bonusdisplay
  171. Field scl#=0.5 ' where on the edge 0.0, 0.25, 0.5, 0.75, 1.0
  172. Field schan:TChannel = Null ' send all shot audio through this channel
  173. Method SetEdge(index)
  174. e_index = index
  175. EndMethod
  176. Method AddShot()
  177. Shot.Create(theLevel.edges[e_Index],zPos)
  178. EndMethod
  179. Method ShiftLeft()
  180. PlaySound(ticksfx)
  181. If e_Index=0
  182. If theLevel.continuous
  183. e_Index = theLevel.e_Cnt-1
  184. EndIf
  185. Else
  186. e_Index:-1
  187. EndIf
  188. EndMethod
  189. Method ShiftRight()
  190. PlaySound(ticksfx)
  191. If e_Index=theLevel.e_cnt-1
  192. If theLevel.continuous
  193. e_Index = 0
  194. EndIf
  195. Else
  196. e_Index:+1
  197. EndIf
  198. EndMethod
  199. Method Update()
  200. ' fire!
  201. If KeyDown(KEY_LCONTROL)
  202. If shottimer > 2
  203. If deathcount = 0 ' no control when dying
  204. If CountList(SHOT_LIST) < 12
  205. Self.AddShot()
  206. PlaySound(shotsfx, schan)
  207. shottimer = 0
  208. EndIf
  209. EndIf
  210. EndIf
  211. EndIf
  212. shottimer:+1
  213. ' superzapper
  214. If KeyHit(KEY_SPACE)
  215. If deathcount = 0
  216. If superzapper > 0
  217. baddies.superZapit(superzapper)
  218. superzapper:-1
  219. EndIf
  220. EndIf
  221. EndIf
  222. ' rotate
  223. If KeyDown(KEY_LEFT)
  224. If deathcount = 0
  225. If theLevel.continuous
  226. scl:-PLAYERSPEED
  227. If scl<0 Then
  228. Self.ShiftLeft()
  229. scl = 1
  230. EndIf
  231. Else
  232. If e_index > 0
  233. scl:-PLAYERSPEED
  234. If scl<0 Then
  235. Self.ShiftLeft()
  236. scl = 1
  237. EndIf
  238. Else
  239. scl:-PLAYERSPEED
  240. If scl < 0 Then
  241. scl = 0
  242. EndIf
  243. EndIf
  244. EndIf
  245. EndIf
  246. EndIf
  247. ' rotate other direction
  248. If KeyDown(KEY_RIGHT)
  249. If deathcount = 0
  250. If theLevel.continuous
  251. scl:+PLAYERSPEED
  252. If scl>1 Then
  253. Self.ShiftRight()
  254. scl = 0
  255. EndIf
  256. Else
  257. If e_index < theLevel.e_cnt-1
  258. scl:+PLAYERSPEED
  259. If scl > 1 Then
  260. Self.ShiftRight()
  261. scl = 0
  262. EndIf
  263. Else
  264. scl:+PLAYERSPEED
  265. If scl > 1 Then
  266. scl = 1
  267. EndIf
  268. EndIf
  269. EndIf
  270. EndIf
  271. EndIf
  272. ' this edge will be player colour
  273. theLevel.edges[e_Index].hasplayer = True
  274. 'we're dying if deathcount has been set to > 0
  275. If deathcount > 0
  276. deathcount:-1
  277. If deathcount = 0
  278. men:-1
  279. deathtype = 0
  280. EndIf
  281. EndIf
  282. 'check score for bonus
  283. If score <> oldscore
  284. If Int(score/10000) > bonusmencnt
  285. men:+1
  286. bonusdisplay = 100
  287. bonusmencnt = score/10000
  288. PlaySound(bonusmansfx)
  289. EndIf
  290. ' keep track of high score
  291. If score > hiscore
  292. hiscore = score
  293. EndIf
  294. EndIf
  295. 'time to show rainbow pattern - for bonus man
  296. If bonusdisplay > 0
  297. If theLevel.state <> LEVEL_BEGIN
  298. bonusdisplay:-1
  299. EndIf
  300. EndIf
  301. EndMethod
  302. Method Draw()
  303. SetRotation 0
  304. 'Draw it
  305. Local zz#,zh#
  306. Local x#[8],y#[8]
  307. Select theLevel.state
  308. Case LEVEL_BEGIN
  309. zPos = theLevel.depth
  310. zz = theLevel.position+theLevel.depth-zPos
  311. zh# = (10.0)*(1.0-zz/1500.0)
  312. Case LEVEL_READY
  313. zPos = theLevel.depth
  314. zz = theLevel.position+theLevel.depth-zPos
  315. zh# = 20.0+10-Abs(scl-0.5)*10.0
  316. Case LEVEL_PLAYER_DYING
  317. Select deathtype
  318. Case KILLED_BY_FLIPPER
  319. zz = theLevel.position+theLevel.depth-zPos' +180-deathcount*3
  320. zh# = 20.0+10-Abs(scl-0.5)*10.0
  321. zh = zh * (deathcount*3)/180.0
  322. Case KILLED_BY_PULSAR
  323. zz = theLevel.position - Sin(deathcount*1.5)*100 +100
  324. zh# = 20.0+10-Abs(scl-0.5)*10.0
  325. Case KILLED_BY_BULLET
  326. zz = theLevel.position + Sin(deathcount*1.5)*20 -20
  327. zh# = 20.0+10-Abs(scl-0.5)*10.0
  328. Default
  329. zPos = theLevel.depth
  330. zz = theLevel.position+theLevel.depth-zPos
  331. zh# = 2+zPos/10-Abs(scl-0.5)*zPos/40
  332. End Select
  333. Case LEVEL_COMPLETE
  334. zPos = theLevel.depth
  335. zz = theLevel.position+theLevel.depth-zPos
  336. zh# = 2+zPos/10-Abs(scl-0.5)*zPos/40
  337. Case LEVEL_START_ZOOM
  338. zPos = theLevel.depth
  339. zz = theLevel.position+theLevel.depth-zPos
  340. zh# = 2+zPos/10-Abs(scl-0.5)*zPos/40
  341. Case LEVEL_ZOOMING
  342. 'zPos = theLevel.depth
  343. zz = theLevel.position+theLevel.depth-zPos
  344. zh# = 30.0-Abs(scl-0.5)*zPos/40
  345. Case LEVEL_REVERSE_ZOOM
  346. zz = theLevel.position+theLevel.depth-zPos
  347. zh# = 2+zPos/10-Abs(scl-0.5)*zPos/40
  348. EndSelect
  349. Local e:Edge = theLevel.edges[e_Index]
  350. TForm(e.p1.x, e.p1.y,zz,x[0],y[0])
  351. TForm(e.p2.x, e.p2.y,zz,x[1],y[1])
  352. Local xn#
  353. Local yn#
  354. Local xd# = x[1]-x[0]
  355. Local yd# = y[1]-y[0]
  356. Local sz# = Sqr(xd*xd + yd*yd)
  357. ' find a perpendicular line to the outside edge of the web
  358. If sz = 0
  359. xn# = 0
  360. yn# = 0
  361. Else
  362. xn# = -yd/sz
  363. yn# = xd/sz
  364. EndIf
  365. If scl > 0.0 And scl < 1.0
  366. x[4] = x[1]-(xd)*scl + xn*zh
  367. y[4] = y[1]-(yd)*scl + yn*zh
  368. x[2] = x[1]-(xd)*0.3 - xn*zh/2
  369. y[2] = y[1]-(yd)*0.3 - yn*zh/2
  370. x[3] = x[1]-(xd)*0.6 - xn*zh/2
  371. y[3] = y[1]-(yd)*0.6 - yn*zh/2
  372. x[5] = x[1]-(xd)*scl + xn*zh/2
  373. y[5] = y[1]-(yd)*scl + yn*zh/2
  374. x[6] = x[1]-(xd)*0.8
  375. y[6] = y[1]-(yd)*0.8
  376. x[7] = x[1]-(xd)*0.2
  377. y[7] = y[1]-(yd)*0.2
  378. Else
  379. ' extreme ends of motion
  380. If scl >.5
  381. x[4] = x[1]-(xd)*scl + xn*zh
  382. y[4] = y[1]-(yd)*scl + yn*zh
  383. x[2] = x[1]-(xd)*0.3 - xn*zh/2
  384. y[2] = y[1]-(yd)*0.3 - yn*zh/2
  385. x[3] = x[1]-(xd)*0.6 - xn*zh/2
  386. y[3] = y[1]-(yd)*0.6 - yn*zh/2
  387. x[6] = x[1]-(xd)*0.9' + xn*zh/8
  388. y[6] = y[1]-(yd)*0.9' + yn*zh/8
  389. x[5] = x[1]-(xd)*0.9 + xn*zh/2
  390. y[5] = y[1]-(yd)*0.9 + yn*zh/2
  391. x[7] = x[1]-(xd)*0.8 + xn*zh
  392. y[7] = y[1]-(yd)*0.8 + yn*zh
  393. x[1] = x[1]-(xd)*0.7 + xn*zh*1.5
  394. y[1] = y[1]-(yd)*0.7 + yn*zh*1.5
  395. Else
  396. x[4] = x[1]-(xd)*scl + xn*zh
  397. y[4] = y[1]-(yd)*scl + yn*zh
  398. x[2] = x[1]-(xd)*0.3 - xn*zh/2
  399. y[2] = y[1]-(yd)*0.3 - yn*zh/2
  400. x[3] = x[1]-(xd)*0.6 - xn*zh/2
  401. y[3] = y[1]-(yd)*0.6 - yn*zh/2
  402. x[7] = x[1]-(xd)*0.1' + xn*zh/8
  403. y[7] = y[1]-(yd)*0.1' + yn*zh/8
  404. x[5] = x[1]-(xd)*0.1 + xn*zh/2
  405. y[5] = y[1]-(yd)*0.1 + yn*zh/2
  406. x[6] = x[1]-(xd)*0.2 + xn*zh
  407. y[6] = y[1]-(yd)*0.2 + yn*zh
  408. x[0] = x[1]-(xd)*0.3 + xn*zh*1.5
  409. y[0] = y[1]-(yd)*0.3 + yn*zh*1.5
  410. EndIf
  411. EndIf
  412. Color(COL_CLAW)
  413. If deathtype <> 5
  414. ' normal claw draw
  415. DrawLine x[0],y[0],x[4],y[4]
  416. DrawLine x[1],y[1],x[4],y[4]
  417. DrawLine x[0],y[0],x[3],y[3]
  418. DrawLine x[1],y[1],x[2],y[2]
  419. DrawLine x[5],y[5],x[6],y[6]
  420. DrawLine x[5],y[5],x[7],y[7]
  421. DrawLine x[3],y[3],x[6],y[6]
  422. DrawLine x[2],y[2],x[7],y[7]
  423. Else
  424. 'death by fuseball
  425. If (deathcount/4)Mod 4 >1 SetColor 255,255,255
  426. For Local i = 0 To 7
  427. Local rv = Rand(0,360)
  428. Local sr = Rnd(4,40)*(60-deathcount)/60
  429. DrawRect (x[2]+x[3])/2+Cos(rv)*sr,(y[2]+y[3])/2+Sin(rv)*sr,2,2
  430. Next
  431. EndIf
  432. If showdebug
  433. DrawText zPos+" "+zh,600,10
  434. EndIf
  435. EndMethod
  436. Method DrawMenLeft()
  437. Local zz#,zh#
  438. Local x#[8],y#[8]
  439. zh# = 10.0
  440. x[0] = 30
  441. y[0] = 60
  442. x[1] = 0
  443. y[1] = 60
  444. Local xn#
  445. Local yn#
  446. Local xd# = -30
  447. Local yd# = 0
  448. Local sz# = 30
  449. xn# = 0
  450. yn# = -1
  451. x[4] = x[1]-(xd)*.5 + xn*zh
  452. y[4] = y[1]-(yd)*.5 + yn*zh
  453. x[2] = x[1]-(xd)*0.3 - xn*zh/2
  454. y[2] = y[1]-(yd)*0.3 - yn*zh/2
  455. x[3] = x[1]-(xd)*0.6 - xn*zh/2
  456. y[3] = y[1]-(yd)*0.6 - yn*zh/2
  457. x[5] = x[1]-(xd)*.5 + xn*zh/2
  458. y[5] = y[1]-(yd)*.5 + yn*zh/2
  459. x[6] = x[1]-(xd)*0.8' + xn*zh/8
  460. y[6] = y[1]-(yd)*0.8' + yn*zh/8
  461. x[7] = x[1]-(xd)*0.2' + xn*zh/8
  462. y[7] = y[1]-(yd)*0.2' + yn*zh/8
  463. Color(COL_CLAW)
  464. Local m = men;If m > 5 Then m = 5
  465. For Local t = 1 To m
  466. DrawLine x[0]+t*40-30,y[0],x[4]+t*40-30,y[4]
  467. DrawLine x[1]+t*40-30,y[1],x[4]+t*40-30,y[4]
  468. DrawLine x[0]+t*40-30,y[0],x[3]+t*40-30,y[3]
  469. DrawLine x[1]+t*40-30,y[1],x[2]+t*40-30,y[2]
  470. DrawLine x[5]+t*40-30,y[5],x[6]+t*40-30,y[6]
  471. DrawLine x[5]+t*40-30,y[5],x[7]+t*40-30,y[7]
  472. DrawLine x[3]+t*40-30,y[3],x[6]+t*40-30,y[6]
  473. DrawLine x[2]+t*40-30,y[2],x[7]+t*40-30,y[7]
  474. Next
  475. If men > 5
  476. DrawString( men,6*40+5-30,50,2.0)
  477. EndIf
  478. EndMethod
  479. Function Create:Player()
  480. Local p:Player = New Player
  481. p.zPos = 400
  482. p.schan = AllocChannel()
  483. Return p
  484. EndFunction
  485. EndType
  486. Type Point
  487. Field x#,y#,xd#,yd#
  488. Field xtarget#,ytarget#
  489. Field xrate#,yrate#
  490. Field xoriginal#,yoriginal#
  491. Field e0:edge
  492. Field e1:edge
  493. Function Create:Point( x#, y# )
  494. Local p:Point = New Point
  495. p.x=x
  496. p.y=y
  497. p.xoriginal# = x
  498. p.yoriginal# = y
  499. p.xtarget# = x
  500. p.ytarget# = y
  501. POINT_LIST.AddLast( p )
  502. Return p
  503. EndFunction
  504. Method SetPointXY( x#, y# )
  505. x=x
  506. y=y
  507. xoriginal# = x
  508. yoriginal# = y
  509. EndMethod
  510. Method Update()
  511. If Abs(xd) > 0.001
  512. xd = xd - xrate
  513. Else
  514. xd = 0
  515. xtarget = x
  516. xrate = 0
  517. EndIf
  518. x = x + xrate
  519. If Abs(yd) > 0.001
  520. yd = yd - yrate
  521. Else
  522. yd = 0
  523. ytarget = y
  524. xrate = 0
  525. EndIf
  526. y = y + yrate
  527. End Method
  528. Method ResetPoint()
  529. x=xoriginal
  530. y=yoriginal
  531. xtarget = xoriginal#
  532. ytarget = yoriginal#
  533. xrate = 0
  534. yrate = 0
  535. xd = 0
  536. yd = 0
  537. End Method
  538. Method MorphPoint(xt#,yt#,xr#,yr#)
  539. x = xtarget
  540. y = ytarget
  541. xtarget = xt
  542. ytarget = yt
  543. xd = xtarget-x
  544. yd = ytarget-y
  545. xrate = Abs(xr)*Sgn(xd)
  546. yrate = Abs(yr)*Sgn(yd)
  547. End Method
  548. Function UpdatePoints()
  549. Local p:Point
  550. For p=EachIn POINT_LIST
  551. p.Update()
  552. Next
  553. EndFunction
  554. Function ResetPoints()
  555. Local p:Point
  556. For p=EachIn POINT_LIST
  557. p.ResetPoint()
  558. Next
  559. EndFunction
  560. EndType
  561. Type Edge
  562. Field index
  563. Field p1:point
  564. Field p2:point
  565. Field angle
  566. Field pulsing
  567. Field haspulser = False
  568. Field hasplayer = False
  569. Field bcol
  570. Field spike:Spikes
  571. Field xx#,yy#
  572. Method Draw( zd1#, zd2#, layer )
  573. If zd1<1 zd1=1
  574. If zd2<1 zd2=1
  575. 'draw the edge at zero position,
  576. 'the depth line and the far point
  577. Local x#[4],y#[4]
  578. TForm p1.x,p1.y,zd1, x[0],y[0]
  579. TForm p1.x,p1.y,zd2, x[1],y[1]
  580. TForm p2.x,p2.y,zd1, x[2],y[2]
  581. TForm p2.x,p2.y,zd2, x[3],y[3]
  582. If pulsing
  583. 'SetBlend LIGHTBLEND
  584. SetLineWidth 2
  585. If (pulsecount) Mod 8 > 3
  586. Color(COL_PULSARS)
  587. Else
  588. Color(COL_BULLETS)
  589. EndIf
  590. DrawLine x[0],y[0],x[1],y[1]
  591. DrawLine x[3],y[3],x[2],y[2]
  592. Else
  593. 'SetBlend LIGHTBLEND
  594. SetLineWidth 2
  595. If hasplayer
  596. Color(COL_CLAW)
  597. Else
  598. If (superzapperdisplay/2) Mod 4 > 1
  599. Color(COL_TANKERS)
  600. Else
  601. Color(COL_LEVEL)
  602. EndIf
  603. EndIf
  604. If layer = 0 And mainPlayer.bonusdisplay > 0
  605. Color(bcol)
  606. EndIf
  607. If layer = 0 Or hasplayer
  608. DrawLine x[0],y[0],x[1],y[1]
  609. DrawLine x[3],y[3],x[2],y[2]
  610. EndIf
  611. If (superzapperdisplay/2) Mod 4 > 1
  612. Color(COL_TANKERS)
  613. Else
  614. Color(COL_LEVEL)
  615. EndIf
  616. DrawLine x[1],y[1],x[3],y[3]'bottom
  617. If haspulser = False
  618. DrawLine x[0],y[0],x[2],y[2]'top
  619. EndIf
  620. EndIf
  621. SetLineWidth 1
  622. If showdebug Then DrawText angle,x[0],y[0]
  623. EndMethod
  624. Function Create:Edge(p1:Point, p2:Point)
  625. Local e:Edge = New edge
  626. 'assign the points
  627. e.p1=p1
  628. e.p2=p2
  629. 'linkem up
  630. p1.e1=e
  631. p2.e0=e
  632. 'store the midpoint for speeding up
  633. e.xx =( ( p2.x - p1.x ) / 2.0 ) + p1.x
  634. e.yy =( ( p2.y - p1.y ) / 2.0 ) + p1.y
  635. Return e
  636. EndFunction
  637. EndType
  638. Type Level
  639. Field depth# = 400
  640. Field position# = 1500
  641. Field state = LEVEL_BEGIN
  642. Field continuous = True
  643. Field cnt
  644. Field hasspikes = False
  645. Field hasflippers = False
  646. Field hastankers = False
  647. Field hastankersp = False
  648. Field hastankersf = False
  649. Field hasfuseballs = False
  650. Field haspulsars = False
  651. 'Field points:TList
  652. Field edges:Edge[20]
  653. Field e_cnt
  654. Method AddPoint:Point(x#,y#)
  655. Local p:Point = Point.Create( x, y )
  656. 'points.AddLast( p )
  657. Return p
  658. EndMethod
  659. Method AddEdge:Edge( p1:Point, p2:point )
  660. Local e:Edge = Edge.Create( p1, p2 )
  661. edges[e_cnt] = e
  662. e_cnt:+1
  663. e.index = e_cnt
  664. Return e
  665. EndMethod
  666. Method Update()
  667. Select state
  668. Case LEVEL_BEGIN
  669. If cnt = 0 Then PlaySound(zoominsfx)
  670. cnt = cnt + 1
  671. If position>50
  672. position:-10
  673. CCenterY = -(position-50)/5 + leveldata[current_board+tubes,1]
  674. Else
  675. state=LEVEL_READY
  676. CCenterY = leveldata[current_board+tubes,1]
  677. EndIf
  678. Case LEVEL_READY
  679. ZOFFSET = 5
  680. mainplayer.zPos = depth
  681. Case LEVEL_PLAYER_DYING
  682. ZOFFSET = 5
  683. If mainplayer.deathcount = 1
  684. state=LEVEL_INTO_VORTEX
  685. cnt = 0
  686. EndIf
  687. Case LEVEL_INTO_VORTEX
  688. cnt:+1
  689. ZOFFSET:+3
  690. If cnt > 60
  691. state=LEVEL_READY
  692. Baddies.ConvertBaddieToEggs()
  693. cnt = 0
  694. ZOFFSET=5
  695. EndIf
  696. Case LEVEL_START_ZOOM
  697. k = 70
  698. ZOFFSET = 5
  699. mainplayer.zPos = depth
  700. cnt = cnt + 1
  701. If cnt > 20
  702. state = LEVEL_ZOOMING
  703. mainPlayer.deathcount = 0
  704. cnt = 0
  705. PlaySound(zoomoutsfx)
  706. EndIf
  707. Case LEVEL_ZOOMING
  708. If ZOFFSET < -40
  709. k = k + 2
  710. If k > 70+30 Then k = k + 2
  711. If mainplayer.zPos < 10
  712. state = LEVEL_COMPLETE
  713. ZOFFSET = 5
  714. cnt = 0
  715. Else
  716. mainplayer.zPos:-3
  717. EndIf
  718. Else
  719. ZOFFSET = ZOFFSET - 2
  720. mainplayer.zPos:-3
  721. EndIf
  722. Case LEVEL_REVERSE_ZOOM
  723. k=k-4
  724. If k<70 Then k = 70
  725. ZOFFSET:+1
  726. If ZOFFSET > 5
  727. ZOFFSET = 5
  728. cnt = cnt + 1
  729. If cnt > 20
  730. If CountList(EGG_LIST) = 0
  731. state = LEVEL_START_ZOOM
  732. Else
  733. state = LEVEL_READY
  734. EndIf
  735. cnt = 0
  736. k=70
  737. mainplayer.deathcount = 0
  738. EndIf
  739. mainplayer.zPos = depth
  740. EndIf
  741. Case LEVEL_COMPLETE
  742. cnt = cnt + 1
  743. If cnt > 60
  744. If startbonus > 0
  745. mainplayer.score:+startbonus
  746. startbonus = 0
  747. EndIf
  748. ZOFFSET = 5
  749. mainplayer.zPos = depth
  750. state = LEVEL_BEGIN
  751. ClearLevel()
  752. current_level:+1
  753. If current_level > 16*6-1
  754. current_level = 0
  755. tubes = tubes+16
  756. If tubes > 32 Then tubes = 0
  757. EndIf
  758. current_board = current_level Mod 16
  759. current_color = current_level/16
  760. SetUpLevel()
  761. SetUpEnemies()
  762. superzapper = 2
  763. MainPlayer.SetEdge( 7 )
  764. cnt = 0
  765. position = 1500
  766. CCenterY = -(position-50)/5 + leveldata[current_board+tubes,1]
  767. FlushKeys()
  768. EndIf
  769. EndSelect
  770. For Local a=0 Until e_cnt
  771. edges[a].pulsing = False
  772. edges[a].haspulser = False
  773. edges[a].hasplayer = False
  774. If mainplayer.bonusdisplay Mod 4 = 3
  775. edges[a].bcol = Rand(0,5)
  776. EndIf
  777. Next
  778. If superzapperdisplay > 0 Then superzapperdisplay:-1
  779. EndMethod
  780. Method UpdateAngles()
  781. Local a
  782. For a=0 Until e_cnt
  783. edges[a].angle = GetAngle#( edges[a].p2.x, edges[a].p2.y, edges[a].p1.x, edges[a].p1.y, edges[(a+1)Mod e_cnt].p1.x, edges[(a+1)Mod e_cnt].p1.y)
  784. Next
  785. If theLevel.continuous = False
  786. edges[14].angle = 0
  787. EndIf
  788. For a=0 Until e_cnt
  789. edges[a].xx =( ( edges[a].p2.x - edges[a].p1.x ) / 2.0 ) + edges[a].p1.x
  790. edges[a].yy =( ( edges[a].p2.y - edges[a].p1.y ) / 2.0 ) + edges[a].p1.y
  791. Next
  792. a=0
  793. If theLevel.continuous = False
  794. edges[a].xx =( ( edges[a].p2.x - edges[a].p1.x ) / 2.0 ) + edges[a].p1.x
  795. edges[a].yy =( ( edges[a].p2.y - edges[a].p1.y ) / 2.0 ) + edges[a].p1.y
  796. EndIf
  797. End Method
  798. Method Draw()
  799. Local a=0
  800. Local oldz
  801. Select state
  802. Case LEVEL_INTO_VORTEX
  803. oldz = ZOFFSET
  804. ZOFFSET = 5
  805. EndSelect
  806. For a=0 Until e_cnt
  807. edges[a].Draw(position,position+depth,0)
  808. Next
  809. For a=0 Until e_cnt
  810. edges[a].Draw(position,position+depth,1)
  811. Next
  812. Select state
  813. Case LEVEL_INTO_VORTEX
  814. ZOFFSET = oldz
  815. EndSelect
  816. EndMethod
  817. Function Create:Level()
  818. Local l:Level = New Level
  819. 'l.points = New TList
  820. Return l
  821. EndFunction
  822. Method mutate()
  823. Local a=0
  824. For a=0 Until e_cnt
  825. Local xt# = Rnd(-1,1)
  826. Local yt# = Rnd(-1,1)
  827. Local xr# = xt/16
  828. Local yr# = yt/16
  829. edges[a].p1.Morphpoint(xt+edges[a].p1.x,yt+edges[a].p1.y,xr,yr)
  830. Next
  831. a=0
  832. If theLevel.continuous = False
  833. Local xt# = Rnd(-1,1)
  834. Local yt# = Rnd(-1,1)
  835. Local xr# = xt/16
  836. Local yr# = yt/16
  837. edges[a].p2.Morphpoint(xt+edges[a].p2.x,yt+edges[a].p2.y,xr,yr)
  838. EndIf
  839. EndMethod
  840. Function LevelSelect()
  841. Local done = False
  842. Local lv = -1
  843. Local index = current_level/2
  844. If index > 42 Then index = 42
  845. Local sel = 0
  846. While lv = -1
  847. If KeyHit(key_left)
  848. sel:-1
  849. If sel < 0
  850. sel = 0
  851. index:-1
  852. If index < 0 Then index = 0
  853. EndIf
  854. PlaySound(ticksfx)
  855. EndIf
  856. If KeyHit(KEY_RIGHT)
  857. sel:+1
  858. If sel > 4
  859. sel = 4
  860. index:+1
  861. If index > 43 Then index = 43
  862. EndIf
  863. PlaySound(ticksfx)
  864. EndIf
  865. Cls
  866. SetColor 255,255,0
  867. DrawString("SELECT STARTING LEVEL",100,10,6.0)
  868. DrawString("HI SCORE "+hiscore,180,500,6.0)
  869. For Local br = 0 To 4
  870. DrawSmallLevel((index+br)*2,190+br*120,300,br=sel)
  871. Next
  872. SetColor 0,255,0
  873. DrawString("LEVEL",80,300-50,2.0)
  874. SetColor 255,0,0
  875. DrawString("BONUS",80,300+50,2.0)
  876. If KeyHit(KEY_LCONTROL)
  877. lv = (index+sel)*2
  878. Local col = lv/16
  879. startbonus = (lv)*(3000+col*1000)+col*7000+((lv)>3)*(lv)*4000
  880. EndIf
  881. If KeyHit(key_t) Then tubes:+16; If tubes > 32 Then tubes = 0
  882. If KeyHit(KEY_ESCAPE) Then done = True;lv=-2
  883. Globalclock:+1
  884. Flip
  885. Delay 16
  886. Wend
  887. If lv > -1
  888. current_level = lv
  889. current_board = lv Mod 16
  890. current_color = lv/16
  891. SetUpLevel()
  892. SetUpEnemies()
  893. superzapper = 2
  894. MainPlayer.SetEdge(7)
  895. theLevel.state = LEVEL_BEGIN
  896. EndIf
  897. Return done
  898. End Function
  899. Function DrawSmallLevel(lv,xoff,yoff,h)
  900. Local col = lv/16
  901. current_color = col
  902. Local b = lv Mod 16
  903. Local sc# = 1.0
  904. Local x1,x2,y1,y2
  905. Local c = leveldata[b+tubes,0]
  906. CCenterY = leveldata[b+tubes,1]
  907. YOFFSET = leveldata[b+tubes,2]
  908. Color(COL_LEVEL)
  909. If h And (Globalclock Mod 30 < 16) Then Color(Rand(0,7));sc = (Globalclock Mod 30)/20.0
  910. For Local a = 0 Until 15
  911. x1 = Float(leveldata[b+tubes,3+a*2])/8*sc
  912. y1 = Float(leveldata[b+tubes,3+a*2+1])/8*sc
  913. x2 = Float(leveldata[b+tubes,3+a*2+2])/8*sc
  914. y2 = Float(leveldata[b+tubes,3+a*2+3])/8*sc
  915. DrawLine x1+xoff,y1+yoff,x2+xoff,y2+yoff
  916. Next
  917. If c
  918. x1 = Float(leveldata[b+tubes,3])/8*sc
  919. y1 = Float(leveldata[b+tubes,3+1])/8*sc
  920. DrawLine x1+xoff,y1+yoff,x2+xoff,y2+yoff
  921. EndIf
  922. SetColor 0,255,0
  923. DrawString(b+1+16*col,xoff-5,yoff-50,2.0)
  924. SetColor 255,0,0
  925. Local l$ = (lv)*(3000+col*1000)+col*7000+((lv)>3)*(lv)*4000
  926. Local ln = Len(l$)*5
  927. DrawString(l$,xoff-ln,yoff+50,2.0)
  928. End Function
  929. EndType
  930. Type Shot
  931. Field e:edge ' the edge its on
  932. Field z# ' its position
  933. Field r# ' rotation
  934. Field xx#,yy#
  935. Method Draw()
  936. Color(COL_BULLETS)
  937. Local zz# = theLevel.depth-z+theLevel.position
  938. Local sz# = TFormSZ(4,zz)
  939. Local pxx#,pyy#
  940. xx = e.xx
  941. yy = e.yy
  942. TForm(xx,yy,zz,pxx,pyy)
  943. For Local a=0 Until 360 Step 45
  944. SetRotation r+a
  945. DrawLine pxx+sz,pyy+sz,pxx-sz,pyy-sz
  946. Next
  947. r:+15
  948. SetRotation 0
  949. EndMethod
  950. Method Update()
  951. z:-6
  952. Local bad:Baddies
  953. If z<0
  954. SHOT_LIST.Remove(Self)
  955. Return
  956. Else
  957. 'check for collisions
  958. For bad = EachIn BADDIE_LIST
  959. If bad.CheckColl(e,z)
  960. SHOT_LIST.Remove(Self)
  961. Return
  962. EndIf
  963. Next
  964. EndIf
  965. EndMethod
  966. Function Create:Shot(e:Edge, zPos)
  967. Local ns:Shot = New Shot
  968. ns.e = e
  969. ns.xx =e.xx
  970. ns.yy =e.yy
  971. ns.z = zPos '+5
  972. SHOT_LIST.AddLast( ns )
  973. Return ns
  974. EndFunction
  975. Function UpdateShots()
  976. Local s:shot
  977. For s=EachIn SHOT_LIST
  978. s.Update()
  979. Next
  980. EndFunction
  981. Function DrawShots()
  982. Local s:shot
  983. For s=EachIn SHOT_LIST
  984. s.Draw()
  985. Next
  986. EndFunction
  987. EndType
  988. Type Explosion
  989. Field x,y
  990. Field cnt '60
  991. Field scale#
  992. Method Draw()
  993. Color(COL_BULLETS)
  994. For Local t = 0 To 7
  995. Local xd = Sin(t*45)*Cos(cnt*3)*scale
  996. Local yd = Cos(t*45)*Cos(cnt*3)*scale
  997. DrawLine x-xd,y-yd,x+xd,y+yd
  998. Next
  999. EndMethod
  1000. Method Update()
  1001. cnt:-3
  1002. If cnt < 0 Then EXPLOSION_LIST.Remove(Self)
  1003. EndMethod
  1004. Function Create:Explosion(x,y,height)
  1005. Local ex:Explosion = New Explosion
  1006. ex.x = x
  1007. ex.y =y
  1008. ex.cnt = 30
  1009. ex.scale# = height/20
  1010. EXPLOSION_LIST.AddLast( ex )
  1011. Return ex
  1012. EndFunction
  1013. Function UpdateDrawExplosions()
  1014. Local s:Explosion
  1015. For s=EachIn EXPLOSION_LIST
  1016. s.Update()
  1017. Next
  1018. For s=EachIn EXPLOSION_LIST
  1019. s.Draw()
  1020. Next
  1021. EndFunction
  1022. EndType
  1023. ' points displayed when a fuseball is shot
  1024. ' 250/500/750/1000
  1025. Type fusepoint
  1026. Field x,y
  1027. Field cnt '60
  1028. Field scale#
  1029. Field pts$
  1030. Method Draw()
  1031. Color(COL_BULLETS)
  1032. DrawString(pts,x,y,scale)
  1033. EndMethod
  1034. Method Update()
  1035. cnt:-1
  1036. If cnt < 0 Then FUSEPOINT_LIST.Remove(Self)
  1037. EndMethod
  1038. Function Create:fusepoint(x,y,height,pt)
  1039. Local ex:fusepoint = New fusepoint
  1040. ex.cnt = 30
  1041. ex.pts = pt
  1042. ex.scale# = height/64+.5
  1043. ex.x = x -ex.scale*1.5
  1044. ex.y = y
  1045. FUSEPOINT_LIST.AddLast( ex )
  1046. Return ex
  1047. EndFunction
  1048. Function UpdateDrawFusePoints()
  1049. Local s:fusepoint
  1050. For s=EachIn FUSEPOINT_LIST
  1051. s.Update()
  1052. Next
  1053. For s=EachIn FUSEPOINT_LIST
  1054. s.Draw()
  1055. Next
  1056. EndFunction
  1057. EndType
  1058. ' enemies in the vortex!
  1059. Type Egg
  1060. Field e_index
  1061. Field height
  1062. Field act
  1063. Field cnt
  1064. Field hdir
  1065. Field dir
  1066. Method DrawStats(x,y)
  1067. DrawText "i= "+e_Index+" a="+act+" h="+Int(height)+" c="+cnt+" d="+hdir,x,y
  1068. End Method
  1069. Method Hatch()
  1070. Local typ = -1
  1071. While typ < 0
  1072. ' turn it into a baddie
  1073. typ = Rand(0,(7-(enemiesleft=0)*3))
  1074. Select typ
  1075. Case 0'flipper
  1076. If theLevel.hasflippers
  1077. flipper.Create(e_Index,0,0)
  1078. Else
  1079. typ = -1
  1080. EndIf
  1081. Case 1'tank
  1082. If theLevel.hastankers
  1083. Local car = -1
  1084. While car < 0
  1085. car = Rand(0,2)
  1086. Select car
  1087. Case 0
  1088. ' carry flippers
  1089. If theLevel.hasflippers
  1090. Tanker.Create(e_Index, Rand(1,2),0,0)
  1091. Else
  1092. car = -1
  1093. EndIf
  1094. Case 1
  1095. ' carry fuseballs
  1096. If theLevel.hastankersf
  1097. Tanker.Create(e_Index, 0,0,Rand(1,2))
  1098. Else
  1099. car = -1
  1100. EndIf
  1101. Case 2
  1102. ' carry pulsars
  1103. If theLevel.hastankersp
  1104. Tanker.Create(e_Index, 0,Rand(1,2),0)
  1105. Else
  1106. car = -1
  1107. EndIf
  1108. End Select
  1109. Wend
  1110. Else
  1111. typ = -1
  1112. EndIf
  1113. Case 4,5,6,7'spinner
  1114. If theLevel.hasspikes
  1115. spinner.Create( e_Index ,Rand(2.0,4.0))
  1116. Else
  1117. typ = -1
  1118. EndIf
  1119. Case 2'fuseball
  1120. If theLevel.hasfuseballs
  1121. fuseball.Create(e_Index,0,0)
  1122. Else
  1123. typ = -1
  1124. EndIf
  1125. Case 3'pulsar
  1126. If theLevel.haspulsars
  1127. Pulsar.Create(e_Index,0,0)
  1128. Else
  1129. typ = -1
  1130. EndIf
  1131. End Select
  1132. Wend
  1133. EGG_LIST.Remove(Self)
  1134. End Method
  1135. Method Update()
  1136. Select act
  1137. Case 0 'move from edge to edge
  1138. cnt:+1
  1139. If cnt > 7
  1140. height:+hdir
  1141. If height >= -1 Or height <= -20 Or Rand(0,100) > 95 Then hdir=-hdir
  1142. cnt = 0
  1143. If dir = 1
  1144. If e_Index=theLevel.e_cnt-1
  1145. If theLevel.continuous
  1146. e_Index = 0
  1147. Else
  1148. dir = 1-dir
  1149. EndIf
  1150. Else
  1151. e_Index:+1
  1152. EndIf
  1153. Else
  1154. If e_Index = 0
  1155. If theLevel.continuous
  1156. e_Index = theLevel.e_Cnt-1
  1157. Else
  1158. dir = 1-dir
  1159. EndIf
  1160. Else
  1161. e_Index:-1
  1162. EndIf
  1163. EndIf
  1164. If theLevel.state=LEVEL_READY
  1165. If Rand(0,100) > 95-hatchrate
  1166. If enemiesleft + hatchingeggs < 12
  1167. act = 1
  1168. hatchingeggs:+1
  1169. EndIf
  1170. EndIf
  1171. EndIf
  1172. EndIf
  1173. Case 1 'move towards web
  1174. cnt:+1
  1175. If cnt > 7
  1176. height:+1
  1177. If height >= 0 Then act = 2
  1178. cnt=0
  1179. EndIf
  1180. Case 2 'hatch
  1181. hatch()
  1182. hatchingeggs:-1
  1183. End Select
  1184. End Method
  1185. Method Draw()
  1186. Local zz# = theLevel.depth-height*20+theLevel.position
  1187. Local pxx#,pyy#
  1188. Local xx# = theLevel.Edges[e_Index].xx
  1189. Local yy# = theLevel.Edges[e_Index].yy
  1190. TForm(xx,yy,zz,pxx,pyy)
  1191. Color(COL_FLIPPERS)
  1192. Plot(pxx,pyy)
  1193. End Method
  1194. Function Create:Egg(index)
  1195. Local e:Egg = New Egg
  1196. e.e_index = index
  1197. e.height = -10
  1198. e.cnt = 0
  1199. e.act = 0
  1200. e.hdir = 1
  1201. e.dir = Rand(0,1)
  1202. EGG_LIST.AddLast( e )
  1203. Return e
  1204. EndFunction
  1205. Function UpdateEggs()
  1206. Local e:egg
  1207. For e = EachIn EGG_LIST
  1208. e.Update()
  1209. Next
  1210. EndFunction
  1211. Function DrawEggs()
  1212. Local e:egg
  1213. Local cnt = 0
  1214. For e = EachIn EGG_LIST
  1215. e.Draw()
  1216. If showdebug Then e.DrawStats(400,cnt*12)
  1217. cnt = cnt + 1
  1218. Next
  1219. EndFunction
  1220. End Type
  1221. Type Baddies
  1222. Field OnEdge:Edge
  1223. Field e_Index 'used to traverse theLevel edgelist
  1224. Field baddietype = 0
  1225. Field dietime = 0
  1226. Field height#
  1227. Method Draw() Abstract
  1228. Method DrawStats(x,y) Abstract
  1229. Method Zapit(t) Abstract
  1230. Method Update() Abstract
  1231. Method CheckColl(e:edge,z#) Abstract 'shots->enemy
  1232. Method CheckPlayerColl() Abstract 'enemy->player
  1233. Function UpdateBaddies()
  1234. onrim = True
  1235. Local b:Baddies
  1236. For b = EachIn BADDIE_LIST
  1237. If theLevel.state = LEVEL_ZOOMING Or theLevel.state = LEVEL_REVERSE_ZOOM
  1238. If b.baddietype = BAD_SPIKE Then b.Update() ' only spikes
  1239. Else
  1240. b.Update()
  1241. If b.baddietype > BAD_SPIKE
  1242. If b.height < 400
  1243. onrim = False
  1244. EndIf
  1245. EndIf
  1246. EndIf
  1247. Next
  1248. For b = EachIn BADDIE_LIST
  1249. If theLevel.state = LEVEL_ZOOMING Or theLevel.state = LEVEL_REVERSE_ZOOM
  1250. If b.baddietype = BAD_SPIKE Then b.CheckPlayerColl()' only spikes
  1251. Else
  1252. If theLevel.state <> LEVEL_PLAYER_DYING Then b.CheckPlayerColl()
  1253. EndIf
  1254. Next
  1255. EndFunction
  1256. Function DrawBaddies()
  1257. Local b:Baddies
  1258. Local cnt = 0
  1259. For b = EachIn BADDIE_LIST
  1260. If theLevel.state = LEVEL_ZOOMING Or theLevel.state = LEVEL_REVERSE_ZOOM
  1261. If b.baddietype = BAD_SPIKE ' only spikes kill when zooming
  1262. b.Draw()
  1263. If showdebug Then b.DrawStats(10,cnt*12)
  1264. EndIf
  1265. Else
  1266. b.Draw()
  1267. If showdebug Then b.DrawStats(10,cnt*12)
  1268. EndIf
  1269. cnt:+1
  1270. Next
  1271. EndFunction
  1272. Function ConvertBaddieToEggs()
  1273. ' player just died - reset the enemies to eggs
  1274. enemiesleft = 0
  1275. Local b:Baddies
  1276. For b = EachIn BADDIE_LIST
  1277. If b.baddietype > BAD_SPIKE ' non spikes or bullets
  1278. BADDIE_LIST.Remove(b)
  1279. ' eggs yet to be created + live eggs
  1280. If eggsleft + CountList(EGG_LIST) < maxeggs
  1281. eggsleft:+1
  1282. EndIf
  1283. Else
  1284. If b.baddietype = BAD_BULLET 'remove bullets, keep spikes
  1285. BADDIE_LIST.Remove(b)
  1286. EndIf
  1287. EndIf
  1288. Next
  1289. ' only strat with max 16 eggs
  1290. If CountList(EGG_LIST) > 16
  1291. eggsleft:+(CountList(EGG_LIST)-16)
  1292. Local cnt = 0
  1293. For Local e:egg = EachIn EGG_LIST
  1294. cnt:+1
  1295. If cnt > 16
  1296. EGG_LIST.Remove(e)
  1297. EndIf
  1298. Next
  1299. EndIf
  1300. End Function
  1301. Function SuperZapit(strength)
  1302. Local b:Baddies
  1303. Local cnt = 4
  1304. If strength = 2
  1305. ' zap them all
  1306. superzapperdisplay = 60
  1307. For b = EachIn BADDIE_LIST
  1308. If b.baddietype <> 1
  1309. If b.Zapit(cnt) Then cnt = cnt + 2
  1310. EndIf
  1311. Next
  1312. Else
  1313. ' find biggest threat and kill it
  1314. Local i = mainplayer.e_index
  1315. Local b_best:baddies = Null
  1316. Local best_d = 16
  1317. Local best_h = 0
  1318. Local best_b = 0
  1319. For b = EachIn BADDIE_LIST
  1320. If b.baddietype > 1
  1321. Local d
  1322. If theLevel.continuous
  1323. d = -(i - b.e_index) 'how far from player
  1324. If Abs(d) > 8 Then d = -d
  1325. Else
  1326. d = -(i - b.e_index)
  1327. EndIf
  1328. d = Abs(d)
  1329. If d < best_d+2
  1330. If b.height > best_h
  1331. b_best = b
  1332. best_d = d
  1333. best_h = b.height
  1334. best_b = b.baddietype
  1335. ' DebugLog("b="+b.baddietype+" i="+b.e_index+" d="+d+" h="+b.height)
  1336. Else
  1337. If d < best_d
  1338. b_best = b
  1339. best_d = d
  1340. best_h = b.height
  1341. best_b = b.baddietype
  1342. ' DebugLog("+ b="+b.baddietype+" i="+b.e_index+" d="+d+" h="+b.height)
  1343. Else
  1344. ' same d, pick the meaner one
  1345. If b.baddietype > best_b
  1346. b_best = b
  1347. best_d = d
  1348. best_h = b.height
  1349. best_b = b.baddietype
  1350. ' DebugLog("++ b="+b.baddietype+" i="+b.e_index+" d="+d+" h="+b.height)
  1351. EndIf
  1352. EndIf
  1353. EndIf
  1354. EndIf
  1355. EndIf
  1356. Next
  1357. If b_best <> Null
  1358. ' DebugLog("Zap b="+b_best.baddietype+" i="+b_best.e_index+" d="+best_d+" h="+best_h)
  1359. b_best.Zapit(4)
  1360. superzapperdisplay = 60
  1361. EndIf
  1362. EndIf
  1363. End Function
  1364. EndType
  1365. Type Bullets Extends Baddies
  1366. Field height# ' its position
  1367. Field r# ' rotation
  1368. Field xx#,yy#
  1369. Method Draw()
  1370. Color(COL_BULLETS)
  1371. Local zz# = theLevel.depth-height+theLevel.position
  1372. Local sz# = TFormSZ(6,zz)
  1373. Local pxx#,pyy#
  1374. xx = onEdge.xx
  1375. yy = onEdge.yy
  1376. TForm(xx,yy,zz,pxx,pyy)
  1377. For Local a=0 Until 360 Step 45
  1378. SetRotation r+a
  1379. DrawLine pxx+sz,pyy,pxx-sz,pyy
  1380. Next
  1381. r:+15
  1382. SetRotation 0
  1383. EndMethod
  1384. Method Update()
  1385. height:+3
  1386. If height > theLevel.depth
  1387. BADDIE_LIST.Remove(Self)
  1388. Return
  1389. EndIf
  1390. EndMethod
  1391. Method CheckColl(e:edge,z#)
  1392. If e = OnEdge
  1393. If z < height
  1394. MainPlayer.Score = MainPlayer.Score+25
  1395. BADDIE_LIST.Remove(Self)
  1396. Return True
  1397. EndIf
  1398. EndIf
  1399. Return False
  1400. EndMethod
  1401. Method CheckPlayerColl()
  1402. If MainPlayer.e_Index = e_index
  1403. If theLevel.depth-height < 8
  1404. PlaySound(killedbybulletsfx)
  1405. BADDIE_LIST.Remove(Self)
  1406. KillPlayer(KILLED_BY_BULLET)
  1407. Return
  1408. EndIf
  1409. EndIf
  1410. Return False
  1411. EndMethod
  1412. Method DrawStats(x,y)
  1413. End Method
  1414. Method ZapIt(t)
  1415. Return False
  1416. End Method
  1417. Function Create:Bullets(index, depth)
  1418. PlaySound(bulletsfx)
  1419. Local b:Bullets = New Bullets
  1420. b.OnEdge = theLevel.edges[index]
  1421. b.e_Index= index
  1422. b.xx = b.onEdge.xx
  1423. b.yy = b.onEdge.yy
  1424. b.height = depth
  1425. b.baddietype = BAD_BULLET
  1426. BADDIE_LIST.AddLast b
  1427. Return b
  1428. EndFunction
  1429. EndType
  1430. Type Tanker Extends Baddies
  1431. Field cargo_flipper 'flipper,pulsar,fuseball 1 or 2 of them
  1432. Field cargo_pulsar
  1433. Field cargo_fuseball
  1434. Field xx#,yy#
  1435. Field hasbullets
  1436. Method Draw()
  1437. Color(COL_TANKERS)
  1438. Local x#[2],y#[2]
  1439. Local zz# = theLevel.depth-height+theLevel.position
  1440. xx = onEdge.xx
  1441. yy = onEdge.yy
  1442. TForm(xx,yy,zz,x[0],y[0])
  1443. Local scale# '= height/theLevel.depth*24.0+1
  1444. scale = TFormSZ(26,zz)+1
  1445. Local scale3# = scale/3
  1446. DrawLine x[0],y[0]-scale3,x[0]-scale,y[0]
  1447. DrawLine x[0],y[0]-scale,x[0]+scale3,y[0]
  1448. DrawLine x[0],y[0]+scale,x[0]-scale3,y[0]
  1449. DrawLine x[0],y[0]+scale3,x[0]+scale,y[0]
  1450. DrawLine x[0],y[0]+scale,x[0]+scale,y[0]
  1451. DrawLine x[0],y[0]+scale,x[0]-scale,y[0]
  1452. DrawLine x[0],y[0]-scale,x[0]+scale,y[0]
  1453. DrawLine x[0],y[0]-scale,x[0]-scale,y[0]
  1454. DrawLine x[0],y[0]+scale3,x[0]+scale3,y[0]
  1455. DrawLine x[0],y[0]+scale3,x[0]-scale3,y[0]
  1456. DrawLine x[0],y[0]-scale3,x[0]+scale3,y[0]
  1457. DrawLine x[0],y[0]-scale3,x[0]-scale3,y[0]
  1458. DrawLine x[0],y[0]+scale3,x[0],y[0]+scale
  1459. DrawLine x[0],y[0]-scale3,x[0],y[0]-scale
  1460. DrawLine x[0]+scale3,y[0],x[0]+scale,y[0]
  1461. DrawLine x[0]-scale3,y[0],x[0]-scale,y[0]
  1462. If cargo_fuseball
  1463. 'draw fuse in the middle
  1464. Color(COL_FLIPPERS)
  1465. DrawLine x[0],y[0],x[0],y[0]+scale3
  1466. Color(COL_SPIKERS)
  1467. DrawLine x[0],y[0],x[0],y[0]-scale3
  1468. Color(COL_PULSARS)
  1469. DrawLine x[0],y[0],x[0]+scale3,y[0]
  1470. Color(COL_CLAW)
  1471. DrawLine x[0],y[0],x[0]-scale3,y[0]
  1472. Else
  1473. If cargo_pulsar
  1474. 'draw pulsar in the middle
  1475. Color(COL_PULSARS)
  1476. DrawLine x[0]-scale3,y[0],x[0],y[0]+scale3/2
  1477. DrawLine x[0],y[0]+scale3/2,x[0],y[0]-scale3/2
  1478. DrawLine x[0],y[0]-scale3/2,x[0]+scale3,y[0]
  1479. EndIf
  1480. EndIf
  1481. EndMethod
  1482. Method ReleaseCargo(stillborn)
  1483. If cargo_flipper > 0
  1484. Local dir = 1-Rand(0,1)*2
  1485. For Local d = 1 To cargo_flipper
  1486. Local e = e_index
  1487. If dir = 1
  1488. If e=0
  1489. If theLevel.continuous
  1490. e = theLevel.e_Cnt-1
  1491. EndIf
  1492. Else
  1493. e:-1
  1494. EndIf
  1495. Else
  1496. If e=theLevel.e_cnt-1
  1497. If theLevel.continuous
  1498. e = 0
  1499. EndIf
  1500. Else
  1501. e:+1
  1502. EndIf
  1503. EndIf
  1504. Local c:flipper = flipper.Create(e,1,height)
  1505. c.dir = -dir
  1506. If stillborn Then c.dietime = 8
  1507. dir = -dir
  1508. Next
  1509. EndIf
  1510. If cargo_fuseball > 0
  1511. Local dir = 1-Rand(0,1)*2
  1512. For Local d = 1 To cargo_fuseball
  1513. Local e = e_index
  1514. If dir = 1
  1515. If e=0
  1516. If theLevel.continuous
  1517. e = theLevel.e_Cnt-1
  1518. EndIf
  1519. Else
  1520. e:-1
  1521. EndIf
  1522. Else
  1523. If e=theLevel.e_cnt-1
  1524. If theLevel.continuous
  1525. e = 0
  1526. EndIf
  1527. Else
  1528. e:+1
  1529. EndIf
  1530. EndIf
  1531. Local c:fuseball= fuseball.Create(e,0,height)
  1532. c.dir = -dir
  1533. If stillborn Then c.dietime = 8
  1534. dir = -dir
  1535. Next
  1536. EndIf
  1537. If cargo_pulsar > 0
  1538. Local dir = 1-Rand(0,1)*2
  1539. For Local d = 1 To cargo_pulsar
  1540. Local e = e_index
  1541. If dir = 1
  1542. If e=0
  1543. If theLevel.continuous
  1544. e = theLevel.e_Cnt-1
  1545. EndIf
  1546. Else
  1547. e:-1
  1548. EndIf
  1549. Else
  1550. If e=theLevel.e_cnt-1
  1551. If theLevel.continuous
  1552. e = 0
  1553. EndIf
  1554. Else
  1555. e:+1
  1556. EndIf
  1557. EndIf
  1558. Local c:pulsar = pulsar.Create(e,0,height)
  1559. c.dir = -dir
  1560. If stillborn Then c.dietime = 8
  1561. dir = -dir
  1562. Next
  1563. EndIf
  1564. EndMethod
  1565. Method ZapIt(t)
  1566. dietime = t 'die after t tics
  1567. Return True
  1568. End Method
  1569. Method Update()
  1570. If dietime > 0
  1571. dietime:-1
  1572. If dietime = 0 'die
  1573. PlaySound(zapsfx,zapchan)
  1574. Local xx#,yy#,zz1#
  1575. MainPlayer.Score = MainPlayer.Score+200
  1576. ReleaseCargo(True) ' it's cargo will die too
  1577. zz1 = theLevel.position + theLevel.depth - height
  1578. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  1579. Explosion.Create(xx,yy,height)
  1580. BADDIE_LIST.Remove(Self)
  1581. enemiesleft:-1
  1582. Return
  1583. EndIf
  1584. EndIf
  1585. height:+2
  1586. If height < 380
  1587. If Rand(0,100) > 98 And hasbullets Then bullets.Create(e_index,height);hasbullets:-1
  1588. EndIf
  1589. If height > theLevel.depth-15
  1590. ReleaseCargo(False)
  1591. BADDIE_LIST.Remove(Self)
  1592. enemiesleft:-1
  1593. EndIf
  1594. EndMethod
  1595. Method CheckColl(e:edge,z#)
  1596. If e = OnEdge
  1597. If z < height
  1598. Local xx#,yy#,zz1#
  1599. MainPlayer.Score = MainPlayer.Score+200
  1600. ReleaseCargo(False)
  1601. zz1 = theLevel.position + theLevel.depth - height
  1602. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  1603. Explosion.Create(xx,yy,height)
  1604. PlaySound(tankershotsfx)
  1605. BADDIE_LIST.Remove(Self)
  1606. enemiesleft:-1
  1607. Return True
  1608. EndIf
  1609. EndIf
  1610. Return False
  1611. EndMethod
  1612. Method CheckPlayerColl()
  1613. Return False
  1614. EndMethod
  1615. Method DrawStats(x,y)
  1616. Color(COL_TANKERS)
  1617. DrawText "i= "+e_Index+" h="+Int(height)+" f="+cargo_flipper+" b="+cargo_fuseball+" p="+cargo_pulsar ,x,y
  1618. End Method
  1619. Function Create:Tanker(index, numc,nump,numf)
  1620. Local t:Tanker = New Tanker
  1621. t.OnEdge = theLevel.edges[index]
  1622. t.cargo_flipper = numc
  1623. t.cargo_pulsar = nump
  1624. t.cargo_fuseball = numf
  1625. t.e_Index= index
  1626. t.xx = t.onEdge.xx
  1627. t.yy = t.onEdge.yy
  1628. t.height = 10
  1629. t.hasbullets = Rand(1,2)
  1630. t.baddietype = BAD_TANKER
  1631. BADDIE_LIST.AddLast t
  1632. enemiesleft:+1
  1633. Return t
  1634. EndFunction
  1635. EndType
  1636. Type Flipper Extends Baddies
  1637. Field typ '0 just slides up the tube
  1638. '1 flips round the tube
  1639. '2 flipping on rim
  1640. '3 pausing
  1641. Field oldtyp
  1642. Field hasbullets
  1643. Field Pause 'the pause before changing edge
  1644. Field dir 'direction left or right
  1645. Field angle# 'the angle when changing lanes
  1646. Field totangle# ' the total angle to flip
  1647. Method DrawStats(x,y)
  1648. Color(COL_FLIPPERS)
  1649. DrawText "i= "+e_Index+" d="+dir+" h="+Int(height)+" a="+Int(angle)+" t="+Int(totangle) ,x,y
  1650. End Method
  1651. Method Draw()
  1652. Local xx#,yy#,zz1#,zz2#
  1653. Local x#[7],y#[7]
  1654. Select typ
  1655. Case 0 ' sliding up
  1656. zz1 = theLevel.position+theLevel.depth
  1657. zz2 = zz1 - height
  1658. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1659. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1660. Case 1,2 ' flipping
  1661. zz1 = theLevel.position+theLevel.depth
  1662. zz2 = zz1 - height
  1663. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1664. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1665. If dir = -1 'pivot around p1 of dest edge (current edge+1)
  1666. TFormR(x[1],y[1],-angle+totangle, x[0],y[0])
  1667. Else
  1668. TFormR(x[0],y[0],-(totangle-angle), x[1],y[1])
  1669. EndIf
  1670. Case 3,7 'delaying
  1671. zz1 = theLevel.position+theLevel.depth
  1672. zz2 = zz1 - height
  1673. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1674. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1675. End Select
  1676. Local xn#
  1677. Local yn#
  1678. Local zh#' = height/(theLevel.position+theLevel.depth)*24
  1679. zh = TFormSZ(20,zz2)
  1680. Local xd# = x[1]-x[0]
  1681. Local yd# = y[1]-y[0]
  1682. Local sz# = Sqr(xd*xd + yd*yd)
  1683. If sz = 0
  1684. xn# = 0
  1685. yn# = 0
  1686. Else
  1687. xn# = -yd/sz
  1688. yn# = xd/sz
  1689. EndIf
  1690. x[2] = x[1]-(xd)*0.3 - xn*zh/2
  1691. y[2] = y[1]-(yd)*0.3 - yn*zh/2
  1692. x[3] = x[1]-(xd)*0.1 - xn*zh
  1693. y[3] = y[1]-(yd)*0.1 - yn*zh
  1694. x[5] = x[1]-(xd)*0.9 - xn*zh
  1695. y[5] = y[1]-(yd)*0.9 - yn*zh
  1696. x[6] = x[1]-(xd)*0.7 - xn*zh/2
  1697. y[6] = y[1]-(yd)*0.7 - yn*zh/2
  1698. Color(COL_FLIPPERS)
  1699. DrawLine x[0],y[0],x[3],y[3]
  1700. DrawLine x[5],y[5],x[1],y[1]
  1701. DrawLine x[6],y[6],x[5],y[5]
  1702. DrawLine x[2],y[2],x[3],y[3]
  1703. DrawLine x[6],y[6],x[0],y[0]
  1704. DrawLine x[2],y[2],x[1],y[1]
  1705. EndMethod
  1706. Method ZapIt(t)
  1707. dietime = t 'die after t tics
  1708. Return True
  1709. End Method
  1710. Method Update()
  1711. If dietime > 0
  1712. dietime:-1
  1713. If dietime = 0 'die
  1714. PlaySound(zapsfx,zapchan)
  1715. Local xx#,yy#,zz1#
  1716. zz1 = theLevel.position + theLevel.depth - height
  1717. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  1718. Explosion.Create(xx,yy,height)
  1719. BADDIE_LIST.Remove(Self)
  1720. enemiesleft:-1
  1721. MainPlayer.Score = MainPlayer.Score+150
  1722. Return
  1723. EndIf
  1724. EndIf
  1725. Select typ
  1726. Case 0 ' sliding up
  1727. If onEdge.Spike
  1728. If height < OnEdge.Spike.height
  1729. height:+2
  1730. Else
  1731. oldtyp = 1
  1732. typ = 3
  1733. EndIf
  1734. Else
  1735. If height < theLevel.Depth
  1736. height:+1
  1737. If canflip Then oldtyp=1;typ = 3
  1738. Else
  1739. height = theLevel.Depth
  1740. oldtyp=2
  1741. typ = 3
  1742. EndIf
  1743. EndIf
  1744. If Rand(0,100) > 98 And hasbullets Then bullets.Create(e_index,height);hasbullets:-1
  1745. dir = FindShortDir(e_Index, MainPlayer.e_Index)
  1746. Case 1,2 ' flipping
  1747. angle = angle + flipflipspeed
  1748. If typ = 1
  1749. If height < theLevel.Depth
  1750. height:+1
  1751. Else
  1752. height = theLevel.Depth
  1753. EndIf
  1754. EndIf
  1755. totangle = theLevel.edges[e_Index].angle'-8
  1756. If dir = -1
  1757. Local ind = e_index-1
  1758. If ind < 0 Then ind = theLevel.e_cnt-1
  1759. totangle = theLevel.edges[ind].angle
  1760. EndIf
  1761. If angle >= totangle
  1762. angle = 0
  1763. If height < theLevel.Depth
  1764. oldtyp = 1
  1765. typ = 3
  1766. Else
  1767. oldtyp = 2 ' return to rim case, not climbing
  1768. typ = 3
  1769. EndIf
  1770. pause = 20
  1771. EndIf
  1772. Case 3 'delaying
  1773. pause :-1
  1774. If height < theLevel.Depth
  1775. height:+1
  1776. Else
  1777. height = theLevel.Depth
  1778. EndIf
  1779. If pause <= 0
  1780. typ = oldtyp
  1781. If height >= theLevel.depth Then dir = FindShortDir(e_Index, MainPlayer.e_Index)
  1782. If theLevel.continuous = False
  1783. If e_index - dir < 0 Or e_index - dir > theLevel.e_cnt-1
  1784. dir = -dir
  1785. EndIf
  1786. EndIf
  1787. 'move to next edge
  1788. If dir = 1
  1789. If e_Index=0
  1790. If theLevel.continuous
  1791. e_Index= theLevel.e_Cnt-1
  1792. Else
  1793. dir = -dir
  1794. EndIf
  1795. Else
  1796. e_Index:-1
  1797. EndIf
  1798. Else
  1799. If e_Index=theLevel.e_cnt-1
  1800. If theLevel.continuous
  1801. e_Index= 0
  1802. Else
  1803. dir = -dir
  1804. EndIf
  1805. Else
  1806. e_Index:+1
  1807. EndIf
  1808. EndIf
  1809. OnEdge = theLevel.edges[e_Index]
  1810. totangle = theLevel.edges[e_Index].angle'-8
  1811. If Rand(0,100) > 98 And hasbullets Then bullets.Create(e_index,height);hasbullets:-1
  1812. If dir = -1
  1813. Local ind = e_index-1
  1814. If ind < 0 Then ind = theLevel.e_cnt-1
  1815. totangle = theLevel.edges[ind].angle '-8
  1816. EndIf
  1817. If onEdge.Spike
  1818. If height < OnEdge.Spike.height
  1819. typ = 0
  1820. EndIf
  1821. Else
  1822. typ = oldtyp
  1823. EndIf
  1824. EndIf
  1825. Case 7 'killing player!
  1826. 'If height> 0 Then height:-3
  1827. End Select
  1828. EndMethod
  1829. Method CheckColl(e:edge,z#)
  1830. Local sp# = height-z
  1831. If e = OnEdge
  1832. If sp < 16 And sp > 0
  1833. Local xx#,yy#,zz1#,x#[2],y#[2]
  1834. If typ = 1 Or typ = 2
  1835. zz1 = theLevel.position+theLevel.depth-height
  1836. TForm(OnEdge.p1.x,OnEdge.p1.y,zz1,x[0],y[0])
  1837. TForm(OnEdge.p2.x,OnEdge.p2.y,zz1,x[1],y[1])
  1838. If dir = -1 'pivot around p1 of dest edge (current edge+1)
  1839. TFormR(x[1],y[1],-angle+totangle, x[0],y[0])
  1840. Else
  1841. TFormR(x[0],y[0],-(totangle-angle), x[1],y[1])
  1842. EndIf
  1843. xx = (x[0]+x[1])/2
  1844. yy = (y[0]+y[1])/2
  1845. Else
  1846. zz1 = theLevel.position + theLevel.depth - height
  1847. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  1848. EndIf
  1849. PlaySound(flippershotsfx)
  1850. Explosion.Create(xx,yy,height)
  1851. BADDIE_LIST.Remove(Self)
  1852. MainPlayer.Score = MainPlayer.Score+150
  1853. enemiesleft:-1
  1854. Return True
  1855. EndIf
  1856. EndIf
  1857. Return False
  1858. EndMethod
  1859. Method CheckPlayerColl()
  1860. If MainPlayer.e_Index = e_index
  1861. If theLevel.depth = height
  1862. If typ <> 1 And typ <> 2
  1863. typ=7
  1864. PlaySound(killedbyflippersfx)
  1865. KillPlayer(KILLED_BY_FLIPPER)
  1866. Return True
  1867. Else
  1868. If Abs(totangle-angle) < 30
  1869. typ=7
  1870. PlaySound(killedbyflippersfx)
  1871. KillPlayer(KILLED_BY_FLIPPER)
  1872. Return True
  1873. EndIf
  1874. EndIf
  1875. EndIf
  1876. EndIf
  1877. Return False
  1878. EndMethod
  1879. Function Create:flipper(index,typ = 0,height)
  1880. Local c:flipper = New flipper
  1881. c.OnEdge = theLevel.edges[index]
  1882. c.e_Index= index
  1883. c.typ = typ
  1884. c.height = height
  1885. c.hasbullets = Rand(1,3)
  1886. c.baddietype = BAD_FLIPPER
  1887. BADDIE_LIST.AddLast c
  1888. enemiesleft:+1
  1889. Return c
  1890. EndFunction
  1891. EndType
  1892. Type Pulsar Extends Baddies
  1893. Field typ
  1894. Field oldtyp
  1895. Field canflip = True
  1896. Field timetoflip = 0
  1897. Field Pause 'the pause before changing edge
  1898. Field dir 'direction left or right
  1899. Field hdir
  1900. Field angle# 'the angle when changing lanes
  1901. Field totangle#
  1902. Method DrawStats(x,y)
  1903. Color(COL_PULSARS)
  1904. DrawText "i= "+e_Index+" d="+dir+" h="+Int(height)+" a="+Int(typ)+" t="+Int(timetoflip) ,x,y
  1905. End Method
  1906. Method Draw()
  1907. Local xx#,yy#,zz1#,zz2#
  1908. Local x#[7],y#[7]
  1909. Select typ
  1910. Case 0,4 ' sliding up/down
  1911. zz1 = theLevel.position+theLevel.depth
  1912. zz2 = zz1 - height
  1913. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1914. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1915. Case 1,2 ' flipping
  1916. zz1 = theLevel.position+theLevel.depth
  1917. zz2 = zz1 - height
  1918. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1919. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1920. If dir = -1 'pivot around p1 of dest edge (current edge+1)
  1921. TFormR(x[1],y[1],-angle+totangle, x[0],y[0])
  1922. Else
  1923. TFormR(x[0],y[0],-(totangle-angle), x[1],y[1])
  1924. EndIf
  1925. Case 3,5,7 'delaying
  1926. zz1 = theLevel.position+theLevel.depth
  1927. zz2 = zz1 - height
  1928. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  1929. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  1930. End Select
  1931. Local xn#
  1932. Local yn#
  1933. Local zh# = pulse_zh#
  1934. Local xd# = x[1]-x[0]
  1935. Local yd# = y[1]-y[0]
  1936. Local sz# = Sqr(xd*xd + yd*yd)
  1937. If sz = 0
  1938. xn# = 0
  1939. yn# = 0
  1940. Else
  1941. xn# = -yd/sz
  1942. yn# = xd/sz
  1943. EndIf
  1944. x[2] = x[1]-(xd)*0.2 - xn*zh
  1945. y[2] = y[1]-(yd)*0.2 - yn*zh
  1946. x[3] = x[1]-(xd)*0.35 + xn*zh
  1947. y[3] = y[1]-(yd)*0.35 + yn*zh
  1948. x[4] = x[1]-(xd)*0.5 - xn*zh
  1949. y[4] = y[1]-(yd)*0.5 - yn*zh
  1950. x[5] = x[1]-(xd)*0.65 + xn*zh
  1951. y[5] = y[1]-(yd)*0.65 + yn*zh
  1952. x[6] = x[1]-(xd)*0.8 - xn*zh
  1953. y[6] = y[1]-(yd)*0.8 - yn*zh
  1954. If pulsing
  1955. Color(COL_BULLETS)
  1956. Else
  1957. Color(COL_PULSARS)
  1958. EndIf
  1959. DrawLine x[1],y[1],x[2],y[2]
  1960. DrawLine x[2],y[2],x[3],y[3]
  1961. DrawLine x[3],y[3],x[4],y[4]
  1962. DrawLine x[4],y[4],x[5],y[5]
  1963. DrawLine x[5],y[5],x[6],y[6]
  1964. DrawLine x[6],y[6],x[0],y[0]
  1965. EndMethod
  1966. Method ZapIt(t)
  1967. dietime = t 'die after t tics
  1968. Return True
  1969. End Method
  1970. Method Update()
  1971. If dietime > 0
  1972. dietime:-1
  1973. If dietime = 0 'die
  1974. PlaySound(zapsfx,zapchan)
  1975. Local xx#,yy#,zz1#
  1976. zz1 = theLevel.position + theLevel.depth - height
  1977. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  1978. Explosion.Create(xx,yy,height)
  1979. BADDIE_LIST.Remove(Self)
  1980. enemiesleft:-1
  1981. MainPlayer.Score = MainPlayer.Score+200
  1982. Return
  1983. EndIf
  1984. EndIf
  1985. onEdge.haspulser = True
  1986. OnEdge.pulsing = pulsing
  1987. timetoflip:+1
  1988. Select typ
  1989. Case 0 ' sliding up
  1990. If height < theLevel.Depth
  1991. height:+1
  1992. If timetoflip > 50
  1993. If Rand(0,1)
  1994. oldtyp=1;typ = 3
  1995. Else
  1996. oldtyp=0;typ = 5
  1997. EndIf
  1998. timetoflip = 0
  1999. EndIf
  2000. Else
  2001. ' reached the top , go down or flip?
  2002. height = theLevel.Depth
  2003. If Rand(0,1) Or rimit
  2004. 'flip
  2005. oldtyp=1;typ = 3
  2006. Else
  2007. 'go down
  2008. oldtyp=4;typ = 5
  2009. EndIf
  2010. timetoflip = 0
  2011. EndIf
  2012. pause = 20
  2013. dir = FindShortDir(e_Index, MainPlayer.e_Index)
  2014. Case 4 ' sliding down
  2015. If height > 0
  2016. height:-1
  2017. If timetoflip > 50
  2018. If Rand(0,1)
  2019. oldtyp=1;typ = 3
  2020. Else
  2021. oldtyp=4;typ = 5
  2022. EndIf
  2023. timetoflip = 0
  2024. EndIf
  2025. Else
  2026. ' reached the bottom
  2027. height = 0
  2028. If Rand(0,1)
  2029. 'flip
  2030. oldtyp=1;typ = 3
  2031. Else
  2032. 'go up
  2033. oldtyp=0;typ = 5
  2034. EndIf
  2035. timetoflip = 0
  2036. EndIf
  2037. pause = 20
  2038. dir = FindShortDir(e_Index, MainPlayer.e_Index)
  2039. Case 1,2 ' flipping
  2040. angle = angle + pulseflipspeed
  2041. If typ = 1
  2042. If height < theLevel.Depth
  2043. height:+1
  2044. Else
  2045. height = theLevel.Depth
  2046. EndIf
  2047. EndIf
  2048. totangle = theLevel.edges[e_Index].angle'-8
  2049. If dir = -1
  2050. Local ind = e_index-1
  2051. If ind < 0 Then ind = theLevel.e_cnt-1
  2052. ' If ind > theLevel.e_cnt-1 Then ind = 0
  2053. totangle = theLevel.edges[ind].angle '-8
  2054. EndIf
  2055. If angle >= totangle
  2056. angle = 0
  2057. If height < theLevel.Depth
  2058. oldtyp = 0
  2059. typ = 5
  2060. Else
  2061. oldtyp = 0 'made it to the rim
  2062. typ = 5
  2063. EndIf
  2064. pause = 20
  2065. EndIf
  2066. Case 5 'delaying 2
  2067. pause :-1
  2068. If pause <= 0
  2069. timetoflip = 0
  2070. typ = oldtyp
  2071. EndIf
  2072. Case 3 'delaying
  2073. pause :-1
  2074. If pause <= 0
  2075. timetoflip = 0
  2076. typ = oldtyp
  2077. If theLevel.continuous = False
  2078. If e_index - dir < 0 Or e_index - dir > theLevel.e_cnt-1
  2079. dir = -dir
  2080. EndIf
  2081. EndIf
  2082. 'move to next edge
  2083. If dir = 1
  2084. If e_Index=0
  2085. If theLevel.continuous
  2086. e_Index= theLevel.e_Cnt-1
  2087. Else
  2088. dir = -dir
  2089. EndIf
  2090. Else
  2091. e_Index:-1
  2092. EndIf
  2093. Else
  2094. If e_Index=theLevel.e_cnt-1
  2095. If theLevel.continuous
  2096. e_Index= 0
  2097. Else
  2098. dir = -dir
  2099. EndIf
  2100. Else
  2101. e_Index:+1
  2102. EndIf
  2103. EndIf
  2104. OnEdge = theLevel.edges[e_Index]
  2105. totangle = theLevel.edges[e_Index].angle'-8
  2106. If dir = -1
  2107. Local ind = e_index-1
  2108. If ind < 0 Then ind = theLevel.e_cnt-1
  2109. totangle = theLevel.edges[ind].angle '-8
  2110. EndIf
  2111. EndIf
  2112. Case 7 'killing player!
  2113. 'If height> 0 Then height:-3
  2114. End Select
  2115. pulsesalive = True
  2116. EndMethod
  2117. Method CheckColl(e:edge,z#)
  2118. Local sp# = height-z
  2119. If e = OnEdge
  2120. If sp < 16 And sp > 0
  2121. Local xx#,yy#,zz1#,x#[2],y#[2]
  2122. If typ = 1 Or typ = 2
  2123. zz1 = theLevel.position+theLevel.depth-height
  2124. TForm(OnEdge.p1.x,OnEdge.p1.y,zz1,x[0],y[0])
  2125. TForm(OnEdge.p2.x,OnEdge.p2.y,zz1,x[1],y[1])
  2126. If dir = -1 'pivot around p1 of dest edge (current edge+1)
  2127. TFormR(x[1],y[1],-angle+totangle, x[0],y[0])
  2128. Else
  2129. TFormR(x[0],y[0],-(totangle-angle), x[1],y[1])
  2130. EndIf
  2131. xx = (x[0]+x[1])/2
  2132. yy = (y[0]+y[1])/2
  2133. Else
  2134. zz1 = theLevel.position + theLevel.depth - height
  2135. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  2136. EndIf
  2137. Explosion.Create(xx,yy,height)
  2138. PlaySound(pulsarshotsfx)
  2139. BADDIE_LIST.Remove(Self)
  2140. MainPlayer.Score = MainPlayer.Score+200
  2141. enemiesleft:-1
  2142. Return True
  2143. EndIf
  2144. EndIf
  2145. Return False
  2146. EndMethod
  2147. Method CheckPlayerColl()
  2148. If MainPlayer.e_Index = e_index
  2149. If theLevel.depth-height < 8
  2150. If typ <> 1 And typ <> 2
  2151. PlaySound(killedbypulsarsfx)
  2152. KillPlayer(KILLED_BY_FLIPPER)
  2153. typ = 7
  2154. Return True
  2155. Else
  2156. If Abs(totangle-angle) < 30
  2157. PlaySound(killedbypulsarsfx)
  2158. KillPlayer(KILLED_BY_FLIPPER)
  2159. typ = 7
  2160. Return True
  2161. EndIf
  2162. EndIf
  2163. Else
  2164. If typ <> 1 And typ <> 2
  2165. If pulsing
  2166. PlaySound(killedbypulsarsfx)
  2167. KillPlayer(KILLED_BY_PULSAR)
  2168. Return True
  2169. EndIf
  2170. EndIf
  2171. EndIf
  2172. EndIf
  2173. Return False
  2174. EndMethod
  2175. Function Create:Pulsar(index,typ = 0,height)
  2176. Local p:Pulsar = New Pulsar
  2177. p.OnEdge = theLevel.edges[index]
  2178. p.e_Index= index
  2179. p.typ = typ
  2180. p.height = height
  2181. p.baddietype = BAD_PULSAR
  2182. BADDIE_LIST.AddLast p
  2183. enemiesleft:+1
  2184. Return p
  2185. EndFunction
  2186. Function UpdatePulseTimers()
  2187. pulsecount:+pulsespeed
  2188. If pulsecount > 180 Then pulsecount = 0
  2189. If pulsecount = 71 And pulsesalive Then PlaySound(pulsesfx)
  2190. If pulsecount > 70 And pulsecount < 110 Then pulsing = True Else pulsing = False
  2191. pulse_zh# = Abs((pulsecount Mod 90)-45)/4.0
  2192. If pulse_zh# < 2 Then pulse_zh# = 0
  2193. If pulse_zh# > 12 Then pulse_zh# = 12
  2194. pulsesalive = False
  2195. End Function
  2196. EndType
  2197. Type Fuseball Extends Baddies
  2198. Field act
  2199. Field cnt
  2200. Field dir
  2201. Field w ' position across the edge
  2202. Method DrawStats(x,y)
  2203. SetColor 255,255,255
  2204. DrawText "i="+e_Index+" h="+Int(height)+" a="+act+" w="+w+" d="+dir ,x,y
  2205. End Method
  2206. Method Draw()
  2207. Local xx#,yy#,zz1#,zz2#,x#[2],y#[2]
  2208. zz1# = theLevel.position+theLevel.depth
  2209. zz2# = zz1 - height
  2210. TForm(OnEdge.p1.x,OnEdge.p1.y,zz2,x[0],y[0])
  2211. TForm(OnEdge.p2.x,OnEdge.p2.y,zz2,x[1],y[1])
  2212. xx = x[1]+(x[0]-x[1]) *w/8
  2213. yy = y[1]+(y[0]-y[1]) *w/8
  2214. Local sc# '= height/theLevel.depth*7.0+1
  2215. sc = TFormSZ(8,zz2)+1
  2216. For Local arm = 0 To 5
  2217. Select arm
  2218. Case 0
  2219. Color(COL_CLAW)
  2220. Case 1
  2221. Color(COL_SPIKERS)
  2222. Case 2
  2223. Color(COL_TANKERS)
  2224. Case 3
  2225. Color(COL_PULSARS)
  2226. Case 4
  2227. Color(COL_FLIPPERS)
  2228. End Select
  2229. For Local i = 0 To 4
  2230. DrawLine xx+fusex[fuseball_frame,arm,i]*sc,yy+fusey[fuseball_frame,arm,i]*sc,xx+fusex[fuseball_frame,arm,i+1]*sc,yy+fusey[fuseball_frame,arm,i+1]*sc
  2231. Next
  2232. Next
  2233. EndMethod
  2234. Method ZapIt(t)
  2235. dietime = t 'die after t tics
  2236. Return True
  2237. End Method
  2238. Method Update()
  2239. If dietime > 0
  2240. dietime:-1
  2241. If dietime = 0 'die
  2242. PlaySound(zapsfx,zapchan)
  2243. Local xx#,yy#,zz1#
  2244. zz1 = theLevel.position + theLevel.depth - height
  2245. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  2246. Local sc = Int((theLevel.depth-height)/100+1)*250
  2247. fusepoint.Create(xx,yy,height,sc)
  2248. MainPlayer.Score = MainPlayer.Score+sc
  2249. BADDIE_LIST.Remove(Self)
  2250. enemiesleft:-1
  2251. Return
  2252. EndIf
  2253. EndIf
  2254. cnt = cnt + 1
  2255. Select act
  2256. Case 0
  2257. If cnt > 8
  2258. If Rand(0,100) > 90 Then dir = -FindShortDir(e_Index, MainPlayer.e_Index)
  2259. cnt = 0
  2260. 'move left or right....
  2261. Select dir
  2262. Case 1
  2263. w = w + 1
  2264. If w >= 8
  2265. w = 0
  2266. If e_Index=theLevel.e_cnt-1
  2267. If theLevel.continuous
  2268. e_Index= 0
  2269. Else
  2270. w = 8
  2271. dir = -dir
  2272. EndIf
  2273. Else
  2274. e_Index:+1
  2275. EndIf
  2276. EndIf
  2277. Case -1
  2278. w = w - 1
  2279. If w =< 0
  2280. w = 8
  2281. If e_Index=0
  2282. If theLevel.continuous
  2283. e_Index= theLevel.e_Cnt-1
  2284. Else
  2285. w = 0
  2286. dir = -dir
  2287. EndIf
  2288. Else
  2289. e_Index:-1
  2290. EndIf
  2291. EndIf
  2292. End Select
  2293. OnEdge = theLevel.edges[e_Index]
  2294. If w = 0 Or w = 8
  2295. act = Rand(1,2)
  2296. If rimit Or height = 0 Then act = 1
  2297. EndIf
  2298. EndIf
  2299. Case 1 ' going up
  2300. If height < theLevel.Depth
  2301. height:+4
  2302. If cnt > 25*(Rand(1,3))
  2303. act = 0
  2304. cnt = 0
  2305. EndIf
  2306. Else
  2307. height = theLevel.Depth
  2308. act = 0
  2309. cnt = 0
  2310. EndIf
  2311. Case 2 ' going down
  2312. If height >= 0
  2313. height:-4
  2314. If cnt > 25*(Rand(1,3))
  2315. act = 0
  2316. cnt = 0
  2317. EndIf
  2318. Else
  2319. act = 0
  2320. cnt = 0
  2321. height = 0
  2322. EndIf
  2323. Case 7
  2324. w = 3
  2325. 'killing player
  2326. End Select
  2327. EndMethod
  2328. Method CheckColl(e:edge,z#)
  2329. Local sp# = height-z
  2330. If e = OnEdge
  2331. If sp < 16 And sp > 0
  2332. If w >1 And w < 7
  2333. Local xx#,yy#,zz1#
  2334. zz1 = theLevel.position + theLevel.depth - height
  2335. TForm(OnEdge.xx,OnEdge.yy,zz1,xx,yy)
  2336. Local sc = Int((theLevel.depth-height)/100+1)*250
  2337. fusepoint.Create(xx,yy,height,sc)
  2338. MainPlayer.Score = MainPlayer.Score+sc
  2339. BADDIE_LIST.Remove(Self)
  2340. PlaySound(fuseballshotsfx)
  2341. enemiesleft:-1
  2342. Return True
  2343. EndIf
  2344. EndIf
  2345. EndIf
  2346. Return False
  2347. EndMethod
  2348. Method CheckPlayerColl()
  2349. If MainPlayer.e_Index = e_index
  2350. If act = 0 And height = theLevel.depth
  2351. If w > 1 And w < 7
  2352. act = 7
  2353. KillPlayer(KILLED_BY_FUSEBALL)
  2354. PlaySound(killedbyfuseballsfx)
  2355. Return True
  2356. EndIf
  2357. EndIf
  2358. EndIf
  2359. Return False
  2360. EndMethod
  2361. Function Create:fuseball(index,act,height)
  2362. Local f:fuseball= New fuseball
  2363. f.OnEdge=theLevel.Edges[index]
  2364. f.height=height
  2365. f.act = act
  2366. f.e_Index = index
  2367. f.cnt = 0
  2368. f.w = 0
  2369. f.dir = 1
  2370. f.baddietype = BAD_FUSEBALL
  2371. BADDIE_LIST.AddLast f
  2372. enemiesleft:+1
  2373. Return f
  2374. EndFunction
  2375. Function UpdateFuseballTimers()
  2376. fuseball_count:+1
  2377. fuseball_frame = (fuseball_count/4) Mod 4
  2378. End Function
  2379. EndType
  2380. Type Spikes Extends Baddies
  2381. Method DrawStats(x,y)
  2382. Color(COL_SPIKERS)
  2383. DrawText "i="+e_Index+" h="+Int(height),x,y
  2384. End Method
  2385. Method Draw()
  2386. Local oldz
  2387. If theLevel.state = LEVEL_INTO_VORTEX
  2388. oldz = ZOFFSET
  2389. ZOFFSET = 5
  2390. EndIf
  2391. Local xx#,yy#,zz1#,zz2#
  2392. zz1 = theLevel.position+theLevel.depth
  2393. zz2 = zz1 - height
  2394. Local x#[2],y#[2]
  2395. xx =( ( OnEdge.p2.x - OnEdge.p1.x ) / 2.0 ) + OnEdge.p1.x
  2396. yy =( ( OnEdge.p2.y - OnEdge.p1.y ) / 2.0 ) + OnEdge.p1.y
  2397. TForm(xx,yy,zz1,x[0],y[0])
  2398. TForm(xx,yy,zz2,x[1],y[1])
  2399. Color(COL_SPIKERS)
  2400. DrawLine x[0],y[0],x[1],y[1]
  2401. Color(COL_BULLETS)
  2402. Plot x[1],y[1]
  2403. If theLevel.state = LEVEL_INTO_VORTEX
  2404. ZOFFSET = oldz
  2405. EndIf
  2406. EndMethod
  2407. Method ZapIt(t)
  2408. Return False
  2409. End Method
  2410. Method Update()
  2411. EndMethod
  2412. Method CheckColl(e:edge,z#)
  2413. 'check to see if shot hits it
  2414. If e = OnEdge
  2415. If z < height
  2416. height:-8
  2417. MainPlayer.Score = MainPlayer.Score+1
  2418. PlaySound(spikeshotsfx)
  2419. If height =< 0
  2420. OnEdge.Spike = Null
  2421. BADDIE_LIST.Remove(Self)
  2422. Return True
  2423. EndIf
  2424. Return True
  2425. EndIf
  2426. EndIf
  2427. Return False
  2428. EndMethod
  2429. Method CheckPlayerColl()
  2430. If MainPlayer.e_Index = e_index
  2431. If height > mainplayer.zPos And mainplayer.deathcount = 0
  2432. PlaySound(killedbyspikesfx)
  2433. KillPlayer(KILLED_BY_SPIKE)
  2434. Return True
  2435. EndIf
  2436. EndIf
  2437. Return False
  2438. EndMethod
  2439. Function Create:Spikes(index,h#)
  2440. Local s:Spikes = New Spikes
  2441. s.OnEdge=theLevel.Edges[index]
  2442. theLevel.Edges[index].Spike = s
  2443. s.e_index = index
  2444. s.height=h
  2445. s.baddietype = BAD_SPIKE
  2446. BADDIE_LIST.AddLast s
  2447. Return s
  2448. EndFunction
  2449. EndType
  2450. Type Spinner Extends Baddies
  2451. Field grow_speed#
  2452. Field growth# = 0
  2453. Field r#
  2454. Field act
  2455. Method DrawStats(x,y)
  2456. Color(COL_SPIKERS)
  2457. DrawText "i="+e_Index+" h="+Int(height)+" a="+act ,x,y
  2458. End Method
  2459. Method Draw()
  2460. Local xx#,yy#,zz1#,zz2#
  2461. zz1# = theLevel.position+theLevel.depth
  2462. zz2# = zz1 - height
  2463. Local x#,y#,xd1#,yd1#,xd2#,yd2#
  2464. xx = OnEdge.xx
  2465. yy = OnEdge.yy
  2466. Color(COL_SPIKERS)
  2467. TForm(xx,yy,zz2,x,y)
  2468. Local scale#' = height/theLevel.depth*16.0+1
  2469. scale = TFormSZ(22,zz2)+2
  2470. For Local sc# = 0 To -13 Step -1
  2471. xd1 = Sin(r+sc*60)*sc*scale/16
  2472. yd1 = Cos(r+sc*60)*sc*scale/16
  2473. xd2 = Sin(r+(sc+1)*60)*(sc+1)*scale/16
  2474. yd2 = Cos(r+(sc+1)*60)*(sc+1)*scale/16
  2475. DrawLine x+xd1,y+yd1,x+xd2,y+yd2
  2476. Next
  2477. r = r+45
  2478. EndMethod
  2479. Method ZapIt(t)
  2480. dietime = t 'die after t tics
  2481. Return True
  2482. End Method
  2483. Method Update()
  2484. If dietime > 0
  2485. dietime:-1
  2486. If dietime = 0 'die
  2487. PlaySound(zapsfx,zapchan)
  2488. MainPlayer.Score = MainPlayer.Score+50
  2489. BADDIE_LIST.Remove(Self)
  2490. enemiesleft:-1
  2491. Return
  2492. EndIf
  2493. EndIf
  2494. Select act
  2495. Case 0
  2496. ' go directly to building spike
  2497. act = 1
  2498. Case 1 ' going up/building spike
  2499. If height < theLevel.Depth-4
  2500. height:+grow_speed
  2501. If onEdge.Spike
  2502. If height > onEdge.Spike.height
  2503. onEdge.Spike.height = height - 4
  2504. growth:+grow_speed
  2505. If growth > 100
  2506. If Rnd(0,140) > 88
  2507. act = 2
  2508. If Rnd(0,100) > 70 Then bullets.Create(e_index,height)
  2509. EndIf
  2510. EndIf
  2511. EndIf
  2512. Else
  2513. OnEdge.Spike = spikes.Create(e_index,10)
  2514. OnEdge.Spike.height = height
  2515. EndIf
  2516. Else
  2517. act = 2
  2518. EndIf
  2519. Case 2 ' going down spike
  2520. growth = 0
  2521. If height > 0
  2522. height:-grow_speed
  2523. Else
  2524. height = 0
  2525. act = 0
  2526. BADDIE_LIST.Remove(Self)
  2527. enemiesleft:-1
  2528. eggsleft:+1
  2529. EndIf
  2530. End Select
  2531. EndMethod
  2532. Method CheckColl(e:edge,z#)
  2533. 'check to see if any will hit
  2534. If e = OnEdge
  2535. If z < height
  2536. MainPlayer.Score = MainPlayer.Score+50
  2537. enemiesleft:-1
  2538. PlaySound(spinnershotsfx)
  2539. BADDIE_LIST.Remove(Self)
  2540. Return True
  2541. EndIf
  2542. EndIf
  2543. Return False
  2544. EndMethod
  2545. Method CheckPlayerColl()
  2546. ' never hits the player
  2547. Return False
  2548. EndMethod
  2549. Function Create:Spinner(index,speed#)
  2550. Local s:Spinner = New Spinner
  2551. s.OnEdge=theLevel.Edges[index]
  2552. s.height=0
  2553. s.act = 0
  2554. s.e_Index = index
  2555. s.grow_speed# = speed
  2556. s.baddietype = BAD_SPINNER
  2557. BADDIE_LIST.AddLast s
  2558. enemiesleft:+1
  2559. Return s
  2560. EndFunction
  2561. EndType
  2562. Function Game()
  2563. Local done = False
  2564. While Not done
  2565. FlushKeys()
  2566. done = theLevel.LevelSelect()
  2567. mainplayer.score = 0
  2568. mainplayer.men = 2
  2569. mainplayer.bonusmencnt = 0
  2570. FlushKeys()
  2571. If Not done
  2572. 'main loop
  2573. Local gamedone = False
  2574. While Not gamedone
  2575. If KeyHit(KEY_ESCAPE) Then gamedone = True
  2576. Local tim = MilliSecs()
  2577. globalclock = globalclock + 1
  2578. If (globalclock Mod enemyreleaserate = 0)
  2579. For Local a = 0 To 5
  2580. If eggsleft > 0
  2581. Egg.Create(Rand(0,theLevel.e_cnt-2+(theLevel.continuous)))
  2582. eggsleft:-1
  2583. EndIf
  2584. Next
  2585. EndIf
  2586. point.UpdatePoints()
  2587. theLevel.Update()
  2588. theLevel.UpdateAngles()
  2589. If theLevel.state <> LEVEL_INTO_VORTEX
  2590. pulsar.UpdatePulseTimers()
  2591. fuseball.UpdateFuseBallTimers()
  2592. shot.UpdateShots()
  2593. egg.UpdateEggs()
  2594. If theLevel.state <> LEVEL_COMPLETE Then Baddies.UpdateBaddies()
  2595. MainPlayer.Update()
  2596. EndIf
  2597. If theLevel.state <> LEVEL_COMPLETE
  2598. theLevel.Draw()
  2599. shot.DrawShots()
  2600. egg.DrawEggs()
  2601. Baddies.DrawBaddies()
  2602. explosion.UpdateDrawExplosions()
  2603. fusepoint.UpdateDrawFusePoints()
  2604. If theLevel.state <> LEVEL_INTO_VORTEX Then MainPlayer.Draw()
  2605. Else
  2606. If startbonus > 0
  2607. DrawString("BONUS",300,170,10)
  2608. Local l$ = startbonus
  2609. Local ln = Len(l$)
  2610. DrawString(startbonus,400-ln*20,270,10)
  2611. EndIf
  2612. DrawString("SUPERZAPPER RECHARGE",120,420,6)
  2613. EndIf
  2614. Color(COL_CLAW)
  2615. MainPlayer.DrawMenLeft()
  2616. DrawString(MainPlayer.Score,10,10,6.0)
  2617. Color(COL_INFO)
  2618. DrawString((current_level+1),400-6*(current_level>8),10,3.0)
  2619. tim = 16-(MilliSecs()-tim)
  2620. If tim > 0 Then Delay tim
  2621. If eggsleft = 0 And CountList(EGG_LIST) = 0
  2622. If enemiesleft = 0 Or onrim = True
  2623. If theLevel.state = LEVEL_READY
  2624. theLevel.state = LEVEL_START_ZOOM
  2625. EndIf
  2626. Else
  2627. rimit = True
  2628. EndIf
  2629. EndIf
  2630. ' If KeyHit(key_u) Then YOFFSET = YOFFSET - 10
  2631. ' If KeyHit(key_j) Then YOFFSET = YOFFSET + 10
  2632. ' DrawText YOFFSET ,700,0
  2633. ' If KeyHit(key_i) Then CCenterY = CCenterY - 10
  2634. ' If KeyHit(key_k) Then CCenterY = CCenterY + 10
  2635. ' DrawText CCenterY,700,20
  2636. If showdebug DrawString(theLevel.state+" ("+eggsleft+")("+CountList(EGG_LIST)+")("+enemiesleft+")",400,40,5.0)
  2637. If KeyDown(KEY_LSHIFT)
  2638. If KeyHit(key_s) Then superzapper = 2
  2639. If KeyHit(key_b) Then mainplayer.score:+10000
  2640. If KeyHit(key_z) Then theLevel.state = LEVEL_START_ZOOM
  2641. If KeyHit(key_m) Then theLevel.mutate()
  2642. If KeyHit(key_n) Then point.ResetPoints()
  2643. If KeyHit(key_t) Then tubes:+16; If tubes > 32 Then tubes = 0
  2644. If KeyHit(key_d) Then showdebug = 1-showdebug
  2645. EndIf
  2646. Local skip = False
  2647. While KeyDown(key_f1) And Not skip
  2648. Delay 100
  2649. If KeyHit(key_f2) Then skip = True
  2650. Wend
  2651. If mainplayer.men < 0 Then gameover();gamedone = True
  2652. Flip
  2653. Cls
  2654. Wend
  2655. ClearLevel()
  2656. EndIf
  2657. Wend
  2658. End Function
  2659. Function GameOver()
  2660. Local done = False
  2661. Local sc# = .2
  2662. Local scd# = .05
  2663. Local s$ = "GAME OVER"
  2664. While Not done
  2665. Cls
  2666. SetColor 0,255,0
  2667. DrawString(s$,400-sc*25,200,sc)
  2668. DrawString(MainPlayer.Score,10,10,6.0)
  2669. DrawString(current_level,400,10,3.0)
  2670. If KeyHit(KEY_SPACE) Then done = True
  2671. If KeyHit(KEY_ESCAPE) Then done = True
  2672. sc = sc + scd
  2673. If sc > 4 Or sc < .1 Then scd = -scd;If s$ = "GAME OVER" Then s$ = "PRESS ZAP" Else s$ = "GAME OVER"
  2674. Flip
  2675. Delay 16
  2676. Wend
  2677. End Function
  2678. Function KillPlayer(nme)
  2679. Select nme
  2680. Case KILLED_BY_BULLET
  2681. mainplayer.deathcount = 60
  2682. theLevel.state = LEVEL_PLAYER_DYING
  2683. mainplayer.deathtype = KILLED_BY_BULLET
  2684. Case KILLED_BY_PULSAR
  2685. mainplayer.deathcount = 60
  2686. theLevel.state = LEVEL_PLAYER_DYING
  2687. mainplayer.deathtype = KILLED_BY_PULSAR
  2688. Case KILLED_BY_SPIKE
  2689. mainplayer.deathcount = 60
  2690. theLevel.state = LEVEL_REVERSE_ZOOM
  2691. mainplayer.deathtype = KILLED_BY_SPIKE
  2692. Baddies.ConvertBaddieToEggs()
  2693. Case KILLED_BY_FLIPPER
  2694. mainplayer.deathcount = 60
  2695. theLevel.state = LEVEL_PLAYER_DYING
  2696. mainplayer.deathtype = KILLED_BY_FLIPPER
  2697. Case KILLED_BY_FUSEBALL
  2698. mainplayer.deathcount = 60
  2699. theLevel.state = LEVEL_PLAYER_DYING
  2700. mainplayer.deathtype = KILLED_BY_FUSEBALL
  2701. End Select
  2702. End Function
  2703. Function FindShortDir(from_i, to_i)
  2704. Local d
  2705. If theLevel.continuous
  2706. ' d = -(MainPlayer.e_Index - e_Index) 'how far from player
  2707. d = -(to_i - from_i) 'how far from player
  2708. If Abs(d) > 8 Then d = -Sgn(d) Else d = Sgn(d) 'take the shorter route
  2709. If d = 0 Then d = 1 - Rand(0,1)*2 '-1 or 1
  2710. Else
  2711. d = -Sgn(to_i - from_i)
  2712. If d = 0 Then d = 1 - Rand(0,1)*2 '-1 or 1
  2713. EndIf
  2714. Return d
  2715. End Function
  2716. Function Color(c)
  2717. Select current_color
  2718. Case 0 'level 1-16
  2719. Select c
  2720. Case COL_BULLETS
  2721. SetColor 255,255,255
  2722. Case COL_CLAW
  2723. SetColor 255,255,0
  2724. Case COL_TANKERS
  2725. SetColor 255,0,255
  2726. Case COL_FLIPPERS
  2727. SetColor 255,0,0
  2728. Case COL_PULSARS
  2729. SetColor 0,255,255
  2730. Case COL_SPIKERS
  2731. SetColor 0,255,0
  2732. Case COL_LEVEL
  2733. SetColor 0,0,255
  2734. Case COL_INFO
  2735. SetColor 0,0,255
  2736. End Select
  2737. Case 1 'level 17-32
  2738. Select c
  2739. Case COL_BULLETS
  2740. SetColor 255,255,255
  2741. Case COL_CLAW
  2742. SetColor 0,255,0
  2743. Case COL_TANKERS
  2744. SetColor 0,0,255
  2745. Case COL_FLIPPERS
  2746. SetColor 255,0,255
  2747. Case COL_PULSARS
  2748. SetColor 255,255,0
  2749. Case COL_SPIKERS
  2750. SetColor 0,255,255
  2751. Case COL_LEVEL
  2752. SetColor 255,0,0
  2753. Case COL_INFO
  2754. SetColor 255,0,0
  2755. End Select
  2756. Case 2 'level 33-48
  2757. Select c
  2758. Case COL_BULLETS
  2759. SetColor 255,255,255
  2760. Case COL_CLAW
  2761. SetColor 0,0,255
  2762. Case COL_TANKERS
  2763. SetColor 0,255,255
  2764. Case COL_FLIPPERS
  2765. SetColor 0,255,0
  2766. Case COL_PULSARS
  2767. SetColor 255,0,255
  2768. Case COL_SPIKERS
  2769. SetColor 255,0,0
  2770. Case COL_LEVEL
  2771. SetColor 255,255,0
  2772. Case COL_INFO
  2773. SetColor 255,255,0
  2774. End Select
  2775. Case 3 'level 49-64
  2776. Select c
  2777. Case COL_BULLETS
  2778. SetColor 255,255,255
  2779. Case COL_CLAW
  2780. SetColor 0,0,255
  2781. Case COL_TANKERS
  2782. SetColor 255,0,255
  2783. Case COL_FLIPPERS
  2784. SetColor 0,255,0
  2785. Case COL_PULSARS
  2786. SetColor 255,255,0
  2787. Case COL_SPIKERS
  2788. SetColor 255,0,0
  2789. Case COL_LEVEL
  2790. SetColor 0,255,255
  2791. Case COL_INFO
  2792. SetColor 0,255,255
  2793. End Select
  2794. Case 4 'level 65-80
  2795. Select c
  2796. Case COL_BULLETS
  2797. SetColor 255,255,255
  2798. Case COL_CLAW
  2799. SetColor 255,255,0
  2800. Case COL_TANKERS
  2801. SetColor 255,0,255
  2802. Case COL_FLIPPERS
  2803. SetColor 255,0,0
  2804. Case COL_PULSARS
  2805. SetColor 0,255,255
  2806. Case COL_SPIKERS
  2807. SetColor 0,255,0
  2808. Case COL_LEVEL
  2809. SetColor 0,0,0
  2810. Case COL_INFO
  2811. SetColor 0,0,255
  2812. End Select
  2813. Case 5 'level 81-96
  2814. Select c
  2815. Case COL_BULLETS
  2816. SetColor 255,255,255
  2817. Case COL_CLAW
  2818. SetColor 255,0,0
  2819. Case COL_TANKERS
  2820. SetColor 255,0,255
  2821. Case COL_FLIPPERS
  2822. SetColor 255,255,0
  2823. Case COL_PULSARS
  2824. SetColor 0,255,255
  2825. Case COL_SPIKERS
  2826. SetColor 0,0,255
  2827. Case COL_LEVEL
  2828. SetColor 0,255,0
  2829. Case COL_INFO
  2830. SetColor 0,255,0
  2831. End Select
  2832. End Select
  2833. End Function
  2834. Function ClearLevel()
  2835. ' delete all eggs and baddies
  2836. Local e:egg
  2837. For e = EachIn EGG_LIST
  2838. EGG_LIST.Remove(e)
  2839. Next
  2840. Local b:Baddies
  2841. For b = EachIn BADDIE_LIST
  2842. BADDIE_LIST.Remove(b)
  2843. Next
  2844. Local s:shot
  2845. For s=EachIn SHOT_LIST
  2846. SHOT_LIST.remove(s)
  2847. Next
  2848. Local p:Point
  2849. For p=EachIn POINT_LIST
  2850. POINT_LIST.Remove(p)
  2851. Next
  2852. For Local a = 0 Until 16
  2853. theLevel.Edges[a] = Null
  2854. Next
  2855. theLevel.E_cnt = 0
  2856. eggsleft = 0
  2857. enemiesleft = 0
  2858. hatchingeggs = 0
  2859. End Function
  2860. Function SetUpLevel()
  2861. Local p1:Point = Null
  2862. Local p2:Point = Null
  2863. Local fp:Point = Null
  2864. theLevel.continuous = leveldata[current_board+tubes,0]
  2865. k = 70
  2866. CCenterY = leveldata[current_board+tubes,1]
  2867. YOFFSET = leveldata[current_board+tubes,2]
  2868. For Local a = 0 Until 16
  2869. p1 = theLevel.AddPoint( Float(leveldata[current_board+tubes,3+a*2]),Float(leveldata[current_board+tubes,3+a*2+1]))
  2870. If p2
  2871. theLevel.AddEdge(p1,p2)
  2872. Else
  2873. fp = p1
  2874. EndIf
  2875. p2=p1
  2876. Next
  2877. If theLevel.continuous
  2878. Local lastedge:edge = theLevel.AddEdge(fp,p2)
  2879. EndIf
  2880. End Function
  2881. Function SetUpEnemies()
  2882. Local lv = current_level
  2883. enemiesleft = 0
  2884. eggsleft = 10+lv*2+current_board*2
  2885. If eggsleft > 100 Then eggsleft = 100
  2886. maxeggs = eggsleft
  2887. For Local t = 0 To 3
  2888. eggsleft:-1
  2889. Egg.Create(Rand(0,theLevel.e_cnt-2+(theLevel.continuous)))
  2890. Next
  2891. theLevel.hasflippers = True
  2892. theLevel.hastankers = False
  2893. theLevel.hasspikes = False
  2894. theLevel.hasfuseballs = False
  2895. theLevel.haspulsars = False
  2896. theLevel.hastankersp = False
  2897. theLevel.hastankersf = False
  2898. If current_board > 2 Or lv > 47 Then theLevel.hasspikes = True
  2899. If lv > 9 Then theLevel.hasfuseballs = True
  2900. If lv > 1 Then theLevel.hastankers = True
  2901. If lv > 15 Then theLevel.haspulsars = True
  2902. If lv > 20 Then theLevel.hastankersp = True
  2903. If lv > 31 Then theLevel.hastankersf = True
  2904. If theLevel.hasspikes
  2905. For Local a = 0 To theLevel.e_cnt-1
  2906. Spikes.Create(a,60.0)
  2907. Next
  2908. EndIf
  2909. enemyreleaserate = 60
  2910. hatchrate = lv/8
  2911. rimit = False
  2912. flipflipspeed = 15+lv/5 'degrees
  2913. pulseflipspeed = 15+lv/9
  2914. fuseclimbspeed = lv/2 ' not used yet
  2915. If lv = 0 Then canflip = False Else canflip = True
  2916. hatchingeggs = 0
  2917. End Function
  2918. Function ReadFuseballData()
  2919. Local x,y
  2920. For Local frame = 0 To 3
  2921. For Local arm = 0 To 4
  2922. For Local i = 0 To 5
  2923. ReadData x
  2924. ReadData y
  2925. fusex[frame,arm,i] = Float(x)/6.0
  2926. fusey[frame,arm,i] = Float(y)/6.0
  2927. Next
  2928. Next
  2929. Next
  2930. End Function
  2931. DefData 0,0, 7,-5, 6,-8, 9,-10, 7,-13, 11,-15
  2932. DefData 0,0, 6,3, 6,6, 10,4, 12,4, 13,12
  2933. DefData 0,0, 2,7, -4,10, 1,14, -4,17, 1,20
  2934. DefData 0,0, -7,4, -7,1, -9,1, -11,6, -14,8
  2935. DefData 0,0, -4,-5, -3,-10, -5,-13, -9,-13, -9,-15
  2936. DefData 0,0, 6,-8, 5,-11, 9,-14, 7,-18, 6,-20
  2937. DefData 0,0, 7,-3, 6,6, 10,6, 6,11, 11,16
  2938. DefData 0,0, -3,8, -7,6, -5,12, -7,17, -3,21
  2939. DefData 0,0, -6,3, -7,-4, -10,2, -11,-4, -18,4
  2940. DefData 0,0, -3,-6, 2,-11, -4,-13, 2,-16, -2,-21
  2941. DefData 0,0, 5,-8, 7,-7, 7,-12, 10,-16, 14,-14
  2942. DefData 0,0, 7,1, 8,5, 11,6, 10,9, 14,10
  2943. DefData 0,0, -5,6, -6,11, -3,11, -6,16, -6,19
  2944. DefData 0,0, -6,1, -8,4, -11,3, -14,5, -16,6
  2945. DefData 0,0, -2,-8, -7,-8, -5,-14, -8,-14, -10,-11
  2946. DefData 0,0, 6,-6, 7,-12, 11,-6, 12,-12, 16,-12
  2947. DefData 0,0, 6,5, 6,8, 11,9, 12,14, 16,14
  2948. DefData 0,0, -3,6, -4,10, -9,11, -6,18, -9,21
  2949. DefData 0,0, -4,2, -6,1, -7,2, -12,1, -15,6
  2950. DefData 0,0, 1,-11, 3,-8, 5,-14, 3,-17, 6,-24
  2951. Function ReadLevelData()
  2952. Local l,t,v
  2953. For Local l = 0 To 47
  2954. For Local t = 0 To 34
  2955. ReadData v
  2956. leveldata[l,t] = v
  2957. Next
  2958. Next
  2959. End Function
  2960. Include "boarddata.bmx"