home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 128 / af128b.adf / EvilInsects.lzx / EvilInsects / Source.Asc < prev    next >
Text File  |  1999-07-21  |  40KB  |  1,747 lines

  1. ; ** START OF BLITZ 2 SOURCE **
  2.  
  3. ; EVIL INSECTS
  4. ; ============
  5. ; Last changed: 30-06-94 (still 45 days and then...I'm 18)
  6. ; Author: Matthijs Hollemans
  7. ;         Van Vlaanderenstraat 8
  8. ;         4791 EP Klundert
  9. ;         The Netherlands
  10. ;         Tel: (INT. CODE+) 01682-4367
  11.  
  12. ; This is the CHEATMODE, type it in correctly and you will be
  13. ; given 9 lives!
  14. ;
  15. ; Today the world is full of evil,
  16. ; Today the world is mean,
  17. ; But in the future near,
  18. ; Insects will be so evil,
  19. ; No man has ever seen,
  20. ; Or dared to fear.
  21.  
  22. ; Anyway, for anybody who is interested in a perfect example of
  23. ; how-not-to-code a cool game, here's the complete source of
  24. ; EVIL INSECTS. I have exclusively for you documented almost
  25. ; every single line of this source, so you probably won't have
  26. ; any problems understanding this code. (Hmmm)
  27.  
  28. ; This source is about 1700 lines long, but that's mainly because
  29. ; of the level-definition data statements in the set_baddies part.
  30. ; The game displays everything with 50 frames a second.
  31. ; To achieve this, I had to cut down the number of enemies and
  32. ; also their size. Some of the shapes in the shapes-files are
  33. ; unused, mainly because they are ugly and I am lazy.
  34.  
  35. ; Well, that's all I'm gonna say about this source, except for
  36. ; some legal stuff. You may not recompile this source and
  37. ; distribute it under the name EVIL INSECTS. I don't really care
  38. ; if you modify it somewhat and give it another name and spread
  39. ; it all over the world, as long as you don't say I screwed it.
  40. ; You may also use some parts of this source in your own programs
  41. ; if you like, coz I don't really care for copyrights about this
  42. ; code.
  43.  
  44. ; Oh yeah, thanx to Mark Sibly and Simon Armstrong and all
  45. ; those dudes at ACID for creating the best Amiga programming
  46. ; language, BLITZ 2! (If it wasn't for them I'd still be
  47. ; struggling with AMOS!)
  48.  
  49. NoCli
  50. WBStartup ; This would be user-friendly, wouldn't it?
  51.  
  52. SetErr: Goto finish: End SetErr ; Stupid-but-easy-error handler
  53.  
  54. If ExecVersion<39 Then Goto AGA_Only ; Show Alert!
  55.  
  56. BLITZ      ; Joepie!
  57. DisplayOff ; Turn off display
  58. QAMIGA     ; Bwerk! Just a quick leave from Blitz
  59.  
  60. ; Initialisation
  61. ; --------------
  62.  
  63. BitMap 0,320,200,7   ; Initialise bitmaps
  64. BitMap 1,320,200,7   ; for game-play
  65. BitMap 3,320,200,7   ; and bitmaps for intro
  66. BitMap 4,320,200,7   ; and hiscore stuff
  67.  
  68. LoadBitMap 0,"GFX1",0  ; Load backdrop and palette
  69. CopyBitMap 0,1         ; Make bitmaps 0 and 1 the same
  70.  
  71. CopyBitMap 0,3       ; Bitmap 3 looks like bitmap 0
  72. Use BitMap 3         ; (NOT !!!)
  73. Boxf 58,16,260,164,0 ; Clear center of screen
  74. Line 57,22,57,158,0
  75. Line 261,22,261,158,0
  76. Line 56,25,56,155,0
  77. Line 262,25,262,155,0
  78. CopyBitMap 3,4       ; Make bitmaps 3 and 4 the same
  79.  
  80. LoadBlitzFont 0,"EVILINSECTS.font" ; Load font (must be in FONTS:)
  81.  
  82. ; NOTE: The reason for the shapenumbers not starting at 0, is the
  83. ; fact that I had created another file which contained font shapes
  84. ; ,but because blitting these on screen meant an enormous
  85. ; decrease in speed (no more 50 frames/sec.) I dropped that file
  86. ; and used a BlitzFont instead.
  87.  
  88. LoadShapes 36,"GFX2"   ; Load main character shapes
  89. LoadShapes 67,"GFX3"   ; Load the rest of the shapes
  90.  
  91. LoadSound 0,"SND1" ; Load explosion sample
  92. LoadSound 1,"SND2" ; Load shooting sample
  93. LoadSound 2,"SND3" ; Load main-character-is-hit sample
  94. LoadSound 3,"SND4" ; Load main-character-collects-coin sample
  95. LoadSound 4,"SND5" ; Load baddie-drops-projectile sample
  96.  
  97. LoadMedModule 0,"SND0"
  98.  
  99. If NTSC Then bse=44 Else bse=64     ; Screen is positioned
  100. InitCopList 0,bse,200,$10007,8,128,0 ; depending on NTSC/PAL mode
  101.  
  102. VWait 100  ; Wait for disk-access to finish
  103. BLITZ      ; Yeah, hurt me, hurt me
  104.  
  105. CreateDisplay 0        ; Create AGA-screen (tadaa, 128 colours)
  106. DisplayPalette 0,0     ; Show palette
  107.  
  108. BlitzKeys On   ; Allow keys to be read in Blitz-mode
  109.  
  110. ; Set hotspots
  111. ; ------------
  112.  
  113. Restore hotspot_data
  114. For t=36 To 66           ; Set main-character hot-spots
  115.   Read hot_x,hot_y
  116.   Handle t,hot_x,hot_y
  117. Next t
  118.  
  119. hotspot_data
  120. Data 10,5,8,9,8,12,8,13,13,9,9,12,6,13,21,5,20,5,19,5,15,5,16,5,21,5,20,5,19,5,15,5,16,5
  121. Data 11,5,11,5,8,5,9,5,12,5,13,5,12,5,9,5,6,5,11,5,10,5,10,5,10,5,10,5
  122.  
  123. For t=67 To 95     ; Set other shape's hot-spots
  124.   MidHandle t
  125. Next t
  126. MidHandle 98
  127.  
  128. ; Set variables
  129. ; -------------
  130.  
  131. Dim anm(79)        ; Array holding main character animation data
  132. Dim star_anm(20)   ; Array holding star animation data
  133. Dim explo_anm(20)  ; Array holding explosion anim data
  134.  
  135. Gosub set_anim     ; Jump to routine to fill above arrays
  136.  
  137. hitot=10                            ; Number of names to store in
  138. Dim hiname$(hitot),hiscore.l(hitot) ; hiscore-array
  139. Gosub init_hiscores                 ; Init hiscores
  140. mxlen=10                  ; Max. length of names in hiscore-array
  141.  
  142. accel=.35          ; Accelleration of main character
  143. friction=.4        ; Friction when slowing down
  144.  
  145. left_border=68     ; Borders of playing-area
  146. right_border=251
  147.  
  148. num_levels=50      ; Number of levels
  149. max_baddies=8      ; Max.number of bad-guys per level
  150.  
  151. Buffer 0,16384     ; Set buffers for blitting
  152. Buffer 1,16384     ; on both bitmaps 0 and 1
  153.  
  154. NEWTYPE .fallingthing ; Some falling object structure
  155.   x.q                 ; X-position
  156.   y                   ; Y-position
  157.   vel                 ; Speed
  158. End NEWTYPE
  159.  
  160. Dim List bomb.fallingthing(2) ; List of projectiles
  161. DEFTYPE.fallingthing coin     ; Coin-definition (= Power-up)
  162. DEFTYPE.fallingthing stone    ; Stone-definition
  163.  
  164. NEWTYPE .bad ; Baddie (or is it spelled Baddy? Who cares...)
  165.   x.q        ; X-position
  166.   y          ; Y-position
  167.   image      ; What baddie looks like
  168.   status     ; 0=Alive 2=Hit(=Dead)
  169.   heading    ; -1=Left 1=Right
  170.   hit_cnt    ; Counter for explosion anim
  171.   dropped    ; True if baddie dropped projectile
  172.   drop_cnt   ; Counter for dropped projectile
  173. End NEWTYPE
  174.  
  175. Dim List baddie.bad(max_baddies) ; List with baddie data
  176.  
  177. Dim num_baddies(num_levels)  ; Number of baddies in certain level
  178. Dim baddie_speed(num_levels) ; Baddie-speed in certain level
  179. Dim attack_mood(num_levels)  ; Random seed of attack in level
  180. Dim drop_time(num_levels)    ; Number of frames after which a
  181.                              ; baddie may drop a projectile again
  182.  
  183. Dim baddie_image(num_levels,max_baddies) ; Image of bad-dudes
  184. Dim baddie_initx(num_levels,max_baddies) ; Initial X-position
  185. Dim baddie_inity(num_levels,max_baddies) ; Initial Y-position
  186.  
  187. Gosub set_baddies ; Put all baddie-data in the right arrays
  188.  
  189. DisplayBitMap 0,3 ; Show bitmap 3 (still empty)
  190. DisplayOn         ; Turn on display
  191.  
  192. ; Intro
  193. ; -----
  194.  
  195. .intro
  196. Gosub clear_stuff    ; Clear indicators
  197.  
  198. StartMedModule 0 ; Start music
  199. SetInt 5         ; Use VBlank interrupt to play music
  200.   PlayMed
  201. End SetInt
  202.  
  203. VWait 25 ; Wait some frames (because of the ESC-key, that's why!)
  204.  
  205. Repeat
  206.   Use BitMap 4         ; Put intro info on bitmap 4
  207.   Boxf 58,16,260,164,0 ; Clear center of screen
  208.   Line 57,22,57,158,0
  209.   Line 261,22,261,158,0
  210.   Line 56,25,56,155,0
  211.   Line 262,25,262,155,0
  212.  
  213.   Blit 98,160,55 ; Put EVIL-INSECTS logo on screen
  214.   BitMapOutput 4
  215.  
  216.   Colour 48:Locate 10,12        ; Print some info about me (hehe)
  217.   NPrint "Fantasy Freaks @1994"
  218.   Colour 51:Locate 15,14
  219.   NPrint "Created by"
  220.   Colour 54:Locate 11,15
  221.   NPrint "Matthijs Hollemans" ; That's me (stupid name, huh? Well, I'm Dutch, that explains it, doesn't it?)
  222.   Colour 57:Locate 10,18
  223.   NPrint "Press FIRE to start!" ; This is what you should do to start this magnificent game (ahum)
  224.   DisplayBitMap 0,4
  225.  
  226.   tm.l=0
  227.   Repeat ; Continue after certain time or after user input
  228.     VWait
  229.     tm+1
  230.     If RawStatus($45)=True ; 'ESC'ape key
  231.       VWait
  232.       Pop Repeat:Pop Repeat:Goto finish
  233.     EndIf
  234.     If Joyb(1)=1 ; Fire button (Joystick 2)
  235.       Pop Repeat:Pop Repeat:Goto new_game
  236.     EndIf
  237.   Until tm>500
  238.  
  239.   Gosub SHOWHISCORES ; Show some hiscores for a change
  240.  
  241.   tm.l=0
  242.   Repeat ; Continue again after certain time or after user input
  243.     VWait
  244.     tm+1
  245.     If RawStatus($45)=True ; 'ESC'ape key
  246.       VWait
  247.       Pop Repeat:Pop Repeat:Goto finish
  248.     EndIf
  249.     If Joyb(1)=1
  250.       Pop Repeat:Pop Repeat:Goto new_game
  251.     EndIf
  252.   Until tm>500
  253. Forever
  254.  
  255. ; New game
  256. ; --------
  257.  
  258. new_game ; A new game starts...
  259.  
  260. ClrInt 5
  261. StopMed  ; ...but first a module stops!
  262.  
  263. db=0               ; Double-buffering counter
  264. DisplayBitMap 0,db ; Display play-screen
  265.  
  266. Use BitMap 3         ; And remove intro-stuff from intro-bitmap
  267. Boxf 58,16,260,164,0 ; Clear center of screen
  268. Line 57,22,57,158,0
  269. Line 261,22,261,158,0
  270. Line 56,25,56,155,0
  271. Line 262,25,262,155,0
  272. CopyBitMap 3,4       ; Make bitmaps 3 and 4 look the same
  273.  
  274. Colour 1,0 ; Set printing colour
  275.  
  276. score.l=0     ; Your score
  277. lives=4       ; The number of lives you have left
  278. you_x.w=160   ; Main character X-position
  279. level=0       ; First level (how obvious...)
  280.  
  281. coin\x=0,0,0  ; Reset coin-data
  282. coin_type=0   ; What coin does. 1=Extra life 2=Speed up 3=Stone speed
  283. stone\x=0,0,2 ; Reset stone-data
  284.  
  285. max_speed=3   ; Maximum speed of main dude
  286. last_moved=0  ; Previous direction of movement (-1,1)
  287.  
  288. ; New Level
  289. ; ---------
  290.  
  291. new_level ; Gosh, a new level
  292.  
  293. ClearList bomb()   ; Remove all projeciles (bombs) from list
  294. ClearList baddie() ; Remove all bad-guys from their list
  295.  
  296. no_coin=True        ; True if no coin has fallen
  297. no_stone=True       ; True if no stone is falling
  298. image=no_move_image ; Reset main character anim
  299.  
  300. level+1             ; Increase level-counter
  301. If level>num_levels Then Goto game_completed
  302.  
  303. ResetList baddie()                ; Init baddies for this level
  304. For t=0 To num_baddies(level)-1
  305.   If AddItem(baddie())
  306.     baddie()\image=baddie_image(level,t)
  307.     baddie()\x=baddie_initx(level,t)
  308.     baddie()\y=baddie_inity(level,t)
  309.     baddie()\heading=-1
  310.     baddie()\status=0
  311.   EndIf
  312. Next t
  313.  
  314. For t=0 To 1
  315.   ; Print number of lives , just for the good looks...
  316.   BitMapOutput t
  317.   Locate 2,8.65
  318.   Print lives
  319.  
  320.   ; Print score
  321.   Locate 23,23.2
  322.   Print score
  323. Next t
  324.  
  325. ; Init Fleet
  326. ; ----------
  327.  
  328. db=1-db ; Hihi (if you'd know how many time had passed before I found out that this was the answer to some stupid problem...)
  329. For star_step=0 To 6  ; Star anim-frames
  330.   For funky=0 To 2    ; Waiting loop
  331.     VWait
  332.     DisplayBitMap 0,db  ;
  333.     db=1-db             ; Double buffering stuff
  334.     Use BitMap db       ;
  335.     UnBuffer db
  336.     BBlit db,anm(image),you_x,129   ; Draw main character
  337.     ResetList baddie()
  338.     For t=0 To num_baddies(level)-1
  339.       If NextItem(baddie())
  340.         USEPATH baddie()
  341.         BBlit db,67+star_step,\x,\y  ; Blit stars at bad-dude
  342.       EndIf                          ; locations
  343.     Next t
  344.   Next funky ; Nice variable name, ain't it?
  345. Next star_step
  346.  
  347. you_hit=False ; You are hit if this flag sais True
  348. hit_cnt=0     ; And this counter counts (syyeaaahh!)
  349.  
  350. UnBuffer db
  351. Gosub draw_all       ; Draw baddies and main character
  352. DisplayBitMap 0,db   ; Show it
  353. VWait 50
  354.  
  355. ; New life
  356. ; --------
  357.  
  358. new_life ; Something like New-Age but different
  359.  
  360. speed=0 ; Speed of main character
  361.  
  362. If no_stone=False ; Stone must keep on falling even if you died (and still have lives left, that is)
  363.   was_fired=True  ; True if you have just fired your gun
  364. Else
  365.   fired=False
  366. EndIf
  367.  
  368. fire_cnt=0 ; Counter used by firing-routines
  369.  
  370. now_moved=0         ; Current direction of movement
  371. image=no_move_image ; Current image of main character
  372. already_right=False ; Has something to do with running-routines
  373. already_left=False  ; This one too
  374.  
  375. you_hit=False ; True if you are hit by projectile
  376. hit_cnt=0     ; Counter if you are hit
  377.  
  378. ; MAIN LOOP
  379. ; ---------
  380.  
  381. .main ; Inspiring label
  382. Repeat
  383.  
  384.   VWait                 ;
  385.   DisplayBitMap 0,db    ;
  386.   db=1-db               ; Do double buffering
  387.   Use BitMap db         ;
  388.   UnBuffer db           ;
  389.  
  390.   If you_hit=False
  391.     Gosub check_stick   ; Check player actions
  392.   Else
  393.     hit_cnt+1
  394.   EndIf
  395.  
  396.   Gosub baddies         ; Update bad-guys
  397.   Gosub stones          ; Handle falling-stone routines
  398.   Gosub bombs           ; Handle projectiles
  399.   Gosub coin            ; Handle falling coin
  400.  
  401.   ResetList baddie()      ; Check for new level (i.e. all baddies
  402.   nr=0                    ; must be dead)
  403.   While NextItem(baddie())
  404.     nr+1
  405.   Wend
  406.   If nr=0
  407.     Pop Repeat: Goto new_level ; New level!
  408.   EndIf
  409.  
  410.   Gosub draw_all ; Update screen (blit all kinds of things)
  411.  
  412.   If hit_cnt>17 Then Pop Repeat: Goto dead_dude ; You are one dead person
  413.  
  414.   If RawStatus($19)=True  ; <P>ause key
  415.     Repeat
  416.       VWait 10
  417.     Until RawStatus($19)=True
  418.     VWait 10
  419.   EndIf
  420.  
  421.   If RawStatus($45)=True ; <ESC>ape key
  422.     UnBuffer 0
  423.     UnBuffer 1
  424.     Goto intro
  425.   EndIf
  426.  
  427. Forever ; There ain't no escape from the main-loop (unless the ESC-key)
  428.  
  429. ; You have lost a life
  430. ; --------------------
  431.  
  432. dead_dude ; Sais it all, doesn't it...
  433.  
  434. lives-1 ; Decrease number of lives
  435. If lives<0 Then lives=0 : Goto game_over
  436.  
  437. max_speed-1 ; Decrease maximum speed (hehe)
  438. If max_speed<3 Then max_speed=3
  439.  
  440. stone\vel-1 ; This is kinda mean, but hey, nobody ever said I was a nice guy... (except for my mum)
  441. If stone\vel<2 Then stone\vel=2
  442.  
  443. Goto new_life ; Typical, all game coders seem to believe in re-incarnation
  444.  
  445. ; Game completed
  446. ; --------------
  447.  
  448. .game_completed ; I hope you won't get this far, because the well-done screen sucks (just like the rest of the game)
  449. UnBuffer 0
  450. UnBuffer 1
  451.  
  452. Use BitMap 3
  453. Boxf 58,16,260,164,0 ; Clear center of screen
  454. Line 57,22,57,158,0
  455. Line 261,22,261,158,0
  456. Line 56,25,56,155,0
  457. Line 262,25,262,155,0
  458. BitMapOutput 3
  459.  
  460. Colour 1
  461. Locate 13,7
  462. NPrint "GAME COMPLETED"
  463. Colour 51
  464. Locate 8,11
  465. NPrint "You are a most excellent"
  466. Colour 54
  467. Locate 13,12
  468. NPrint "insect killer!"
  469. Colour 57
  470. temp$="Your score: "+Str$(score)
  471. Locate 20-Len(temp$)/2,15
  472. NPrint temp$
  473. DisplayBitMap 0,3
  474.  
  475. Repeat
  476. Until Joyb(1)=1
  477. VWait 10
  478. Goto hiscores
  479.  
  480. ; Game over
  481. ; ---------
  482.  
  483. .game_over ; You will be seeing this a lot or you must be one of those dudes who cheat (lamer!)
  484. UnBuffer 0
  485. UnBuffer 1
  486. ResetList baddie()       ; Remove all left-over baddies
  487. While NextItem(baddie())
  488.   KillItem baddie()
  489. Wend
  490.  
  491. Use BitMap 3
  492. Boxf 58,16,260,164,0 ; Clear center of screen
  493. Line 57,22,57,158,0
  494. Line 261,22,261,158,0
  495. Line 56,25,56,155,0
  496. Line 262,25,262,155,0
  497. BitMapOutput 3
  498.  
  499. Colour 1
  500. Locate 15,7
  501. NPrint "GAME OVER"
  502. Colour 51
  503. Locate 9,11
  504. NPrint "You are a most unlucky"
  505. Colour 54
  506. Locate 13,12
  507. NPrint "insect killer!"
  508. Colour 57
  509. temp$="Your score: "+Str$(score)
  510. Locate 20-Len(temp$)/2,15
  511. NPrint temp$
  512. DisplayBitMap 0,3
  513.  
  514. Repeat
  515. Until Joyb(1)=1
  516. VWait 10
  517.  
  518. Goto hiscores
  519.  
  520. ; Check player actions
  521. ; --------------------
  522.  
  523. .check_stick
  524.  
  525.   If fired=True   ; You have fired your gun
  526.  
  527.     If fire_cnt=1 ; Play a nice shootin' sample
  528.       Sound 1,1
  529.     EndIf
  530.  
  531.     fire_cnt+1
  532.     If fire_cnt<8 ; Show shooting-animation
  533.     image+1
  534.     Else
  535.       If last_moved=-1
  536.         image=shoot_left_end
  537.       Else
  538.         image=shoot_right_end
  539.       EndIf
  540.     EndIf
  541.  
  542.     If fire_cnt=8      ; Initialise magic stars
  543.       stars=True       ; and calculate the position
  544.       star_cnt=-1      ; where they have to show up
  545.       If last_moved=-1
  546.         dest_x=you_x-78
  547.         dest_y=15
  548.         If dest_x<=left_border-13
  549.           delta_x=you_x-left_border
  550.           dest_y=113-Int((delta_x/78)*115)
  551.           dest_x=left_border-13
  552.         EndIf
  553.       Else
  554.         dest_x=you_x+78
  555.         dest_y=15
  556.         If dest_x=>right_border+12
  557.           delta_x=right_border-you_x
  558.           dest_y=113-Int((delta_x/78)*115)
  559.           dest_x=right_border+12
  560.         EndIf
  561.       EndIf
  562.     EndIf
  563.  
  564.     If fire_cnt=28
  565.       If dest_x<right_border+12 AND dest_x>left_border-13
  566.         stone\x=dest_x,11    ; <--+
  567.         no_stone=False       ;    |
  568.       EndIf                  ; Make stone fall from ceiling,
  569.     EndIf                    ; if maximum not reached and ceiling
  570.                              ; was hit
  571.     If fire_cnt=28
  572.       fired=False   ; Stop firing
  573.       speed=0
  574.       was_fired=True
  575.       ;fire_wait=0
  576.     EndIf
  577.  
  578.     Goto leave0
  579.   EndIf
  580.  
  581.   If Joyb(1)=1 AND no_stone=True ; Fire button pressed
  582.     fired=True
  583.     fire_cnt=-1
  584.     If last_moved=-1             ; Calculate image
  585.       image=shoot_left_start
  586.     Else
  587.       image=shoot_right_start
  588.     EndIf
  589.     Goto leave0
  590.   EndIf
  591.  
  592.   now_moved=Joyx(1) ; Find out what direction user is pushing joystick in
  593.  
  594.   If was_fired=True        ; After firing, return the right
  595.     If now_moved=-1        ; shape
  596.       image=run_left_start
  597.     EndIf
  598.     If now_moved=1
  599.      image=run_right_start
  600.     EndIf
  601.     If now_moved=0
  602.       image=no_move_image
  603.     EndIf
  604.     was_fired=False
  605.   EndIf
  606.  
  607.   If now_moved=-1          ; Joystick left
  608.  
  609.     already_right=False    ; Calculate image
  610.     If already_left=False
  611.       image=run_left_start
  612.       already_left=True
  613.     Else
  614.       If image<run_left_end
  615.         image+1
  616.       Else
  617.         image=run_left_start
  618.       EndIf
  619.     EndIf
  620.  
  621.     speed-accel
  622.     If speed<=-max_speed   ; Calculate speed
  623.       speed=-max_speed
  624.     EndIf
  625.  
  626.     you_x+speed            ; Change position
  627.   EndIf
  628.  
  629.   If now_moved=1           ; Joystick right
  630.  
  631.     already_left=False     ; Calculate image
  632.     If already_right=False
  633.       image=run_right_start
  634.       already_right=True
  635.     Else
  636.       If image<run_right_end
  637.         image+1
  638.       Else
  639.         image=run_right_start
  640.       EndIf
  641.     EndIf
  642.  
  643.     speed+accel
  644.     If speed>=max_speed    ; Calculate speed
  645.       speed=max_speed
  646.     EndIf
  647.  
  648.     you_x+speed            ; Change position
  649.   EndIf
  650.  
  651.   If now_moved=0           ; No joystick movement
  652.  
  653.     already_right=False
  654.     already_left=False
  655.     If last_moved=-1        ; Previous direction was left
  656.  
  657.       If image<run_left_end ; Calculate image
  658.         image+1
  659.       Else
  660.         image=run_left_start
  661.       EndIf
  662.  
  663.       If speed<0            ; Calculate speed
  664.         speed+friction
  665.       Else
  666.         speed=0
  667.       EndIf
  668.  
  669.       you_x+speed           ; Calculate position
  670.     EndIf
  671.  
  672.     If last_moved=1          ; Previous direction was right
  673.  
  674.       If image<run_right_end ; Calculate image
  675.         image+1
  676.       Else
  677.         image=run_right_start
  678.       EndIf
  679.  
  680.       If speed>0             ; Calculate speed
  681.         speed-friction
  682.       Else
  683.         speed=0
  684.       EndIf
  685.  
  686.       you_x+speed            ; Calculate position
  687.     EndIf
  688.   EndIf
  689.  
  690.   If speed=0 AND now_moved=0 ; No movement image
  691.     image=no_move_image      ; i.e. main character does not move
  692.   EndIf
  693.  
  694.   If you_x<left_border       ; Check left borders
  695.     you_x=left_border
  696.     speed=0
  697.   EndIf
  698.   If you_x>right_border      ; Check right border
  699.     you_x=right_border
  700.     speed=0
  701.   EndIf
  702.  
  703.   If now_moved<>0            ; Remember previous movement
  704.     last_moved=now_moved
  705.   EndIf
  706. leave0
  707. Return
  708.  
  709. ; Update screen
  710. ; -------------
  711.  
  712. .draw_all
  713.  
  714. If you_hit=False
  715.   If fire_cnt=>3 AND fire_cnt<=12 ; Draw flame from gun
  716.     If last_moved=-1
  717.       BBlit db,97,you_x-20,109,128
  718.     Else
  719.       BBlit db,96,you_x+10,109,128
  720.     EndIf
  721.   EndIf
  722. EndIf
  723.  
  724. If you_hit=True
  725.   If db=0
  726.     image=die_image
  727.   Else
  728.     image=no_move_image
  729.   EndIf
  730. EndIf
  731. BBlit db,anm(image),you_x,129 ; Draw main character
  732.  
  733. ResetList baddie()
  734. While NextItem(baddie())
  735.   BBlit db,baddie()\image,baddie()\x,baddie()\y ; Draw baddies
  736. Wend
  737.  
  738. If no_coin=False
  739.   BBlit db,coin_image,coin\x,coin\y ; Draw coin
  740. EndIf
  741.  
  742. If no_stone=False
  743.   BBlit db,81,stone\x,stone\y ; Draw stone
  744. EndIf
  745.  
  746. ResetList bomb()
  747. While NextItem(bomb())
  748.   BBlit db,86,bomb()\x,bomb()\y ; Draw projectiles (= bombs)
  749. Wend
  750.  
  751. If stars=True
  752.   star_cnt+1
  753.   If star_cnt<20
  754.     BBlit db,star_anm(star_cnt),dest_x,dest_y ; Draw magic stars
  755.   Else
  756.     stars=False
  757.   EndIf
  758. EndIf
  759.  
  760. ; Print number of lives
  761. BitMapOutput db
  762. Locate 2,8.65
  763. Print lives
  764.  
  765. ; Print score
  766. Locate 23,23.2
  767. Print score
  768. Return
  769.  
  770. ; Create animation arrays
  771. ; -----------------------
  772.  
  773. .set_anim
  774. Restore anim_data
  775.  
  776. For t=0 To 79           ; Main character animation array
  777.   Read temp
  778.   anm(t)=temp
  779. Next t
  780.  
  781. anim_data
  782. Data 36 ; no_move (0)
  783. Data 37,37,37,37,37,38,38,38,39    ; Shoot_right (1-9)
  784. Data 40,40,40,40,40,41,41,41,42    ; Shoot_left  (10-18)
  785. Data 43,43,43,44,44,44,45,45,45,46 ; Run_right
  786. Data 46,46,47,47,47,48,48,48,49,49 ; (19-48)
  787. Data 49,50,50,50,51,51,51,52,52,52 ;
  788. Data 53,53,53,54,54,54,55,55,55,56 ; Run_left
  789. Data 56,56,57,57,57,58,58,58,59,59 ; (49-78)
  790. Data 59,60,60,60,61,61,61,62,62,62 ;
  791. Data 63 ; Die_image (79)
  792.  
  793. run_right_start=19 ; Some variables containing start and end
  794. run_right_end=48   ; positions of some anims in the anm()-array
  795. run_left_start=49
  796. run_left_end=78
  797.  
  798. die_image=79
  799.  
  800. shoot_right_start=1
  801. shoot_right_end=9
  802. shoot_left_start=10
  803. shoot_left_end=18
  804.  
  805. no_move_image=0
  806.  
  807. Restore star_data
  808. For t=0 To 20      ; Magic stars animation array
  809.   Read temp
  810.   star_anm(t)=temp
  811. Next t
  812.  
  813. star_data
  814. Data 67,67,67,68,68,68,69,69,69
  815. Data 70,70,70,71,71,71,72,72,72
  816. Data 73,73,73
  817.  
  818. Restore explo_data ; Explosion animation array
  819. For t=0 To 20
  820.   Read temp
  821.   explo_anm(t)=temp
  822. Next t
  823.  
  824. explo_data
  825. Data 74,74,74,75,75,75,76,76,76
  826. Data 77,77,77,78,78,78,79,79,79
  827. Data 80,80,80
  828.  
  829. Return
  830.  
  831. ; Handle falling stones
  832. ; ---------------------
  833.  
  834. .stones
  835. If no_stone=False   ; Only do the following if a stone is falling
  836.   stone\y+stone\vel ; Update positions
  837.   If stone\y>162    ; Check if stone doesn't fall through floor
  838.     no_stone=True
  839.   Else
  840.     ResetList baddie()       ; Check for baddie-hit
  841.     While NextItem(baddie())
  842.       If baddie()\status<>2  ; Don't check for hit if baddie is already hit
  843.         If ShapesHit(81,stone\x,stone\y,baddie()\image,baddie()\x,baddie()\y)=True ; Yikes!
  844.           baddie()\status=2
  845.           baddie()\hit_cnt=-1           ; Baddie is hit
  846.           no_stone=True
  847.           score+(baddie()\image-86)*100 ; Add score to keep player happy
  848.           If score>999999999 Then score=999999999
  849.           Sound 0,2                     ; Play sample
  850.           Pop While : Goto nex2
  851.         EndIf
  852.       EndIf
  853.     Wend
  854.   EndIf
  855. EndIf
  856. nex2
  857. Return
  858.  
  859. ; Handle projectiles dropped by baddies
  860. ; -------------------------------------
  861.  
  862. .bombs
  863.  
  864. ; Update positions
  865.  
  866. ResetList bomb()
  867. While NextItem(bomb())
  868.   USEPATH bomb()
  869.   \y+\vel            ; Update positions
  870.   If \y>162          ; Check if bomb doesn't fall through floor
  871.     KillItem bomb()
  872.   Else
  873.     If RectsHit(\x-3,\y-2,6,4,you_x-10,124,18,41) ; Check for player-hit
  874.       you_hit=True        ; Main character is hit
  875.       Sound 2,4           ; And you can hear it too
  876.       KillItem bomb()     ; Projectile disappears
  877.       Pop While: Goto nex1
  878.     EndIf
  879.   EndIf
  880. Wend
  881. nex1
  882. If you_hit=True          ; If you are hit, all other projectiles
  883.   ResetList bomb()       ; also disappear
  884.   While NextItem(bomb())
  885.     KillItem bomb()
  886.   Wend
  887. EndIf
  888. Return
  889.  
  890. ; Handle baddies
  891. ; --------------
  892.  
  893. .baddies
  894. ResetList baddie()
  895. While NextItem(baddie())
  896.   USEPATH baddie()
  897.   \x+\heading*baddie_speed(level) ; Update position
  898.   If \x<left_border               ; Check left border
  899.     \x=left_border
  900.     \heading=1                    ; Adapt heading
  901.   EndIf
  902.   If \x>right_border     ; Check right border
  903.     \x=right_border
  904.     \heading=-1          ; Adapt heading
  905.   EndIf
  906.   If \dropped=True   ; Increase drop counter if dropped
  907.     \drop_cnt+1
  908.   EndIf
  909.   If \drop_cnt>drop_time(level) ; Baddie may drop again if drop counter is more than drop_time(level)
  910.     \dropped=False
  911.   EndIf
  912.   If \status<>2 ; Baddie can only drop if he's not hit and he has not dropped a projectile yet
  913.     If \dropped=False
  914.       If Int(Rnd(1000))<attack_mood(level) ; Only drop if in attack mood (just a random number)
  915.         If AddItem(bomb())
  916.           \dropped=True
  917.           Sound 4,8     ; Just a little bit of SFX
  918.           \drop_cnt=0
  919.           bomb()\x=baddie()\x,baddie()\y+10,Int(Rnd(3))+1 ; Speed of bomb is random (just for the hell of it...)
  920.         EndIf
  921.       EndIf
  922.     EndIf
  923.   Else
  924.     \hit_cnt+1 ; If baddie is hit, then increase hit counter...
  925.     If \hit_cnt<21
  926.       baddie()\image=explo_anm(\hit_cnt) ; ...and update explosion frame number
  927.     Else                                 ; Hit counter is more than 21 now, so...
  928.       If no_coin=True                    ; ...if no coin is falling right now,
  929.         If Int(Rnd(16))=1                ; then drop coin if random check=ok
  930.           coin\x=baddie()\x,baddie()\y,2
  931.           coin_type=Int(Rnd(3))+1           ; Coin type is determined by random function
  932.           If coin_type=1 Then coin_image=82 ; Find out what image belongs to coin type
  933.           If coin_type=2 Then coin_image=85
  934.           If coin_type=3 Then coin_image=84
  935.           no_coin=False                     ; Set flag that a coin is falling
  936.         EndIf
  937.       EndIf
  938.       KillItem baddie()  ; Remove baddie from list
  939.     EndIf
  940.   EndIf
  941. Wend
  942. Return
  943.  
  944. ; Handle falling coin
  945. ; -------------------
  946.  
  947. .coin
  948. If no_coin=False ; Only do the following if coin is falling
  949.   USEPATH coin
  950.   \y+\vel                     ; Change position
  951.   If \y>159 Then no_coin=True ; until coin hits the floor
  952.  
  953.   If RectsHit(coin\x-5,coin\y-5,10,10,you_x-10,124,18,41) ; Check for a coin-main dude hit
  954.     no_coin=True
  955.     Sound 3,1      ; Player picked up coin, play sample (Hurray...)
  956.     If coin_type=1            ; Extra life-coin
  957.       lives+1:score+250       ; Add life and score
  958.       If lives>9 Then lives=9
  959.     EndIf
  960.     If coin_type=2                   ; Extra speed-coin
  961.       max_speed+1: score+150         ; Add speed and score
  962.       If max_speed>6 Then max_speed=6
  963.     EndIf
  964.     If coin_type=3                    ; Extra stone-speed-coin
  965.       stone\vel+1:score+200           ; Add stone-speed and score
  966.       If stone\vel>5 Then stone\vel=5
  967.     EndIf
  968.   EndIf
  969. EndIf
  970. Return
  971.  
  972. ; Initialise baddies for every level
  973. ; ----------------------------------
  974.  
  975. .set_baddies
  976. Restore baddie_data
  977. For t=1 To num_levels  ; Read the following stuff in some arrays
  978.   Read num_baddies(t)  ; (explanation of these in the Initialise
  979.   Read baddie_speed(t) ;  section of this source)
  980.   Read attack_mood(t)
  981.   Read drop_time(t)
  982.   For u=0 To num_baddies(t)-1
  983.     Read baddie_image(t,u)
  984.     Read baddie_initx(t,u)
  985.     Read baddie_inity(t,u)
  986.   Next u
  987. Next t
  988.  
  989. baddie_data       ; These are a lot of data-statements containing
  990. ; * Level1 *      ; initial coordinates and all (50 levels!)
  991. Data 3 ; num_baddies
  992. Data 1 ; baddie_speed
  993. Data 1 ; attack_mood
  994. Data 50 ; drop_time
  995. Data 87,130,60
  996. Data 87,160,60
  997. Data 87,190,60
  998. ; * Level2 *
  999. Data 5 ; num_baddies
  1000. Data 1 ; baddie_speed
  1001. Data 2 ; attack_mood
  1002. Data 75 ; drop_time
  1003. Data 87,120,60
  1004. Data 87,140,60
  1005. Data 87,160,60
  1006. Data 87,180,60
  1007. Data 87,200,60
  1008. ; * Level3 *
  1009. Data 4 ; num_baddies
  1010. Data 1 ; baddie_speed
  1011. Data 3 ; attack_mood
  1012. Data 30 ; drop_time
  1013. Data 88,130,60
  1014. Data 87,150,60
  1015. Data 87,170,60
  1016. Data 88,190,60
  1017. ; * Level4 *
  1018. Data 7 ; num_baddies
  1019. Data 1 ; baddie_speed
  1020. Data 3 ; attack_mood
  1021. Data 20 ; drop_time
  1022. Data 88,120,60
  1023. Data 87,140,50
  1024. Data 87,140,70
  1025. Data 88,160,60
  1026. Data 87,180,50
  1027. Data 87,180,70
  1028. Data 88,200,60
  1029. ; * Level5 *
  1030. Data 6 ; num_baddies
  1031. Data 1 ; baddie_speed
  1032. Data 4 ; attack_mood
  1033. Data 10 ; drop_time
  1034. Data 90,110,60
  1035. Data 88,130,60
  1036. Data 87,150,60
  1037. Data 87,170,60
  1038. Data 88,190,60
  1039. Data 90,210,60
  1040. ; * Level6 *
  1041. Data 6 ; num_baddies
  1042. Data 1 ; baddie_speed
  1043. Data 4 ; attack_mood
  1044. Data 50 ; drop_time
  1045. Data 90,131,50
  1046. Data 88,150,50
  1047. Data 87,150,70
  1048. Data 87,170,70
  1049. Data 88,170,50
  1050. Data 90,190,50
  1051. ; * Level7 *
  1052. Data 7 ; num_baddies
  1053. Data 1 ; baddie_speed
  1054. Data 5 ; attack_mood
  1055. Data 40 ; drop_time
  1056. Data 88,130,42
  1057. Data 88,130,60
  1058. Data 88,130,78
  1059. Data 90,160,60
  1060. Data 88,190,42
  1061. Data 88,190,60
  1062. Data 88,190,78
  1063. ; * Level8 *
  1064. Data 7 ; num_baddies
  1065. Data 1 ; baddie_speed
  1066. Data 5 ; attack_mood
  1067. Data 30 ; drop_time
  1068. Data 91,120,50
  1069. Data 91,120,70
  1070. Data 90,140,60
  1071. Data 88,160,60
  1072. Data 90,180,60
  1073. Data 91,200,50
  1074. Data 91,200,70
  1075. ; * Level9 *
  1076. Data 7 ; num_baddies
  1077. Data 1 ; baddie_speed
  1078. Data 6 ; attack_mood
  1079. Data 20 ; drop_time
  1080. Data 91,120,50
  1081. Data 87,120,70
  1082. Data 90,140,60
  1083. Data 88,160,70
  1084. Data 90,180,60
  1085. Data 91,200,50
  1086. Data 87,200,70
  1087. ; * Level10 *
  1088. Data 7 ; num_baddies
  1089. Data 1 ; baddie_speed
  1090. Data 6 ; attack_mood
  1091. Data 10 ; drop_time
  1092. Data 91,110,42
  1093. Data 90,130,60
  1094. Data 88,150,78
  1095. Data 87,160,42
  1096. Data 88,170,78
  1097. Data 90,190,60
  1098. Data 91,210,42
  1099. ; * Level11 *
  1100. Data 3 ; num_baddies
  1101. Data 2 ; baddie_speed
  1102. Data 2 ; attack_mood
  1103. Data 50 ; drop_time
  1104. Data 90,140,42
  1105. Data 90,160,60
  1106. Data 90,180,78
  1107. ; * Level12 *
  1108. Data 5 ; num_baddies
  1109. Data 2 ; baddie_speed
  1110. Data 2 ; attack_mood
  1111. Data 40 ; drop_time
  1112. Data 91,120,42
  1113. Data 91,140,60
  1114. Data 92,160,78
  1115. Data 91,180,60
  1116. Data 91,200,42
  1117. ; * Level13 *
  1118. Data 5 ; num_baddies
  1119. Data 2 ; baddie_speed
  1120. Data 3 ; attack_mood
  1121. Data 30 ; drop_time
  1122. Data 90,120,78
  1123. Data 91,140,60
  1124. Data 92,160,42
  1125. Data 91,180,60
  1126. Data 90,200,78
  1127. ; * Level14 *
  1128. Data 6 ; num_baddies
  1129. Data 2 ; baddie_speed
  1130. Data 3 ; attack_mood
  1131. Data 20 ; drop_time
  1132. Data 92,120,78
  1133. Data 91,140,60
  1134. Data 90,160,42
  1135. Data 92,160,78
  1136. Data 91,180,60
  1137. Data 90,200,42
  1138. ; * Level15 *
  1139. Data 7 ; num_baddies
  1140. Data 2 ; baddie_speed
  1141. Data 4 ; attack_mood
  1142. Data 10 ; drop_time
  1143. Data 88,110,50
  1144. Data 91,130,50
  1145. Data 90,130,70
  1146. Data 87,160,50
  1147. Data 91,190,50
  1148. Data 90,190,70
  1149. Data 88,210,50
  1150. ; * Level16 *
  1151. Data 7 ; num_baddies
  1152. Data 2 ; baddie_speed
  1153. Data 4 ; attack_mood
  1154. Data 50 ; drop_time
  1155. Data 92,120,50
  1156. Data 88,140,50
  1157. Data 90,150,70
  1158. Data 91,160,50
  1159. Data 91,170,70
  1160. Data 88,180,50
  1161. Data 92,200,50
  1162. ; * Level17 *
  1163. Data 7 ; num_baddies
  1164. Data 2 ; baddie_speed
  1165. Data 5 ; attack_mood
  1166. Data 40 ; drop_time
  1167. Data 87,130,42
  1168. Data 92,130,60
  1169. Data 91,130,78
  1170. Data 93,160,78
  1171. Data 91,190,78
  1172. Data 92,190,60
  1173. Data 87,190,42
  1174. ; * Level18 *
  1175. Data 7 ; num_baddies
  1176. Data 2 ; baddie_speed
  1177. Data 5 ; attack_mood
  1178. Data 30 ; drop_time
  1179. Data 87,110,50
  1180. Data 92,110,70
  1181. Data 91,130,60
  1182. Data 93,160,60
  1183. Data 91,190,60
  1184. Data 87,210,50
  1185. Data 92,210,70
  1186. ; * Level19 *
  1187. Data 7 ; num_baddies
  1188. Data 2 ; baddie_speed
  1189. Data 6 ; attack_mood
  1190. Data 20 ; drop_time
  1191. Data 92,120,42
  1192. Data 92,120,60
  1193. Data 92,120,78
  1194. Data 93,160,60
  1195. Data 94,200,42
  1196. Data 94,200,60
  1197. Data 94,200,78
  1198. ; * Level20 *
  1199. Data 7 ; num_baddies
  1200. Data 2 ; baddie_speed
  1201. Data 6 ; attack_mood
  1202. Data 10 ; drop_time
  1203. Data 93,130,50
  1204. Data 93,150,50
  1205. Data 93,170,50
  1206. Data 93,190,50
  1207. Data 94,140,70
  1208. Data 94,160,70
  1209. Data 94,180,70
  1210. ; * Level21 *
  1211. Data 3 ; num_baddies
  1212. Data 3 ; baddie_speed
  1213. Data 2 ; attack_mood
  1214. Data 50 ; drop_time
  1215. Data 93,180,42
  1216. Data 94,160,60
  1217. Data 92,140,78
  1218. ; * Level22 *
  1219. Data 7 ; num_baddies
  1220. Data 3 ; baddie_speed
  1221. Data 2 ; attack_mood
  1222. Data 40 ; drop_time
  1223. Data 91,100,42
  1224. Data 92,120,60
  1225. Data 93,140,78
  1226. Data 87,160,60
  1227. Data 93,180,78
  1228. Data 92,200,60
  1229. Data 91,220,42
  1230. ; * Level23 *
  1231. Data 7 ; num_baddies
  1232. Data 3 ; baddie_speed
  1233. Data 3 ; attack_mood
  1234. Data 30 ; drop_time
  1235. Data 90,100,78
  1236. Data 91,120,60
  1237. Data 92,140,42
  1238. Data 88,160,60
  1239. Data 92,180,42
  1240. Data 91,200,60
  1241. Data 90,220,78
  1242. ; * Level24 *
  1243. Data 6 ; num_baddies
  1244. Data 3 ; baddie_speed
  1245. Data 3 ; attack_mood
  1246. Data 20 ; drop_time
  1247. Data 92,120,42
  1248. Data 91,140,60
  1249. Data 90,160,78
  1250. Data 92,160,42
  1251. Data 91,180,60
  1252. Data 90,200,78
  1253. ; * Level25 *
  1254. Data 7 ; num_baddies
  1255. Data 3 ; baddie_speed
  1256. Data 4 ; attack_mood
  1257. Data 10 ; drop_time
  1258. Data 88,110,70
  1259. Data 91,130,70
  1260. Data 90,130,50
  1261. Data 87,160,70
  1262. Data 91,190,70
  1263. Data 90,190,50
  1264. Data 88,210,70
  1265. ; * Level26 *
  1266. Data 7 ; num_baddies
  1267. Data 3 ; baddie_speed
  1268. Data 4 ; attack_mood
  1269. Data 50 ; drop_time
  1270. Data 92,120,70
  1271. Data 88,140,70
  1272. Data 90,140,50
  1273. Data 91,160,70
  1274. Data 88,180,70
  1275. Data 90,180,50
  1276. Data 92,200,70
  1277. ; * Level27 *
  1278. Data 7 ; num_baddies
  1279. Data 3 ; baddie_speed
  1280. Data 5 ; attack_mood
  1281. Data 40 ; drop_time
  1282. Data 87,130,78
  1283. Data 92,130,60
  1284. Data 91,130,42
  1285. Data 93,160,42
  1286. Data 91,190,42
  1287. Data 92,190,60
  1288. Data 87,190,78
  1289. ; * Level28 *
  1290. Data 7 ; num_baddies
  1291. Data 3 ; baddie_speed
  1292. Data 5 ; attack_mood
  1293. Data 30 ; drop_time
  1294. Data 90,120,60
  1295. Data 92,140,42
  1296. Data 91,140,60
  1297. Data 94,160,78
  1298. Data 91,180,60
  1299. Data 92,180,42
  1300. Data 90,200,60
  1301. ; * Level29 *
  1302. Data 7 ; num_baddies
  1303. Data 3 ; baddie_speed
  1304. Data 6 ; attack_mood
  1305. Data 20 ; drop_time
  1306. Data 92,120,42
  1307. Data 92,120,60
  1308. Data 92,120,78
  1309. Data 93,160,60
  1310. Data 94,200,42
  1311. Data 94,200,60
  1312. Data 94,200,78
  1313. ; * Level30 *
  1314. Data 7 ; num_baddies
  1315. Data 3 ; baddie_speed
  1316. Data 6 ; attack_mood
  1317. Data 10 ; drop_time
  1318. Data 87,120,60
  1319. Data 88,140,42
  1320. Data 90,140,78
  1321. Data 88,160,42
  1322. Data 90,160,78
  1323. Data 88,180,42
  1324. Data 90,180,78
  1325. Return
  1326. ; * Level31 *
  1327. Data 5 ; num_baddies
  1328. Data 4 ; baddie_speed
  1329. Data 3 ; attack_mood
  1330. Data 50 ; drop_time
  1331. Data 93,140,42
  1332. Data 93,140,78
  1333. Data 94,160,60
  1334. Data 95,180,78
  1335. Data 95,180,42
  1336. ; * Level32 *
  1337. Data 7 ; num_baddies
  1338. Data 4 ; baddie_speed
  1339. Data 3 ; attack_mood
  1340. Data 40 ; drop_time
  1341. Data 91,130,78
  1342. Data 92,110,60
  1343. Data 93,130,42
  1344. Data 87,160,42
  1345. Data 93,190,42
  1346. Data 92,210,60
  1347. Data 91,190,78
  1348. ; * Level33 *
  1349. Data 7 ; num_baddies
  1350. Data 4 ; baddie_speed
  1351. Data 4 ; attack_mood
  1352. Data 30 ; drop_time
  1353. Data 91,130,42
  1354. Data 92,110,60
  1355. Data 93,130,78
  1356. Data 87,160,78
  1357. Data 93,190,78
  1358. Data 92,210,60
  1359. Data 91,190,42
  1360. ; * Level34 *
  1361. Data 7 ; num_baddies
  1362. Data 4 ; baddie_speed
  1363. Data 4 ; attack_mood
  1364. Data 20 ; drop_time
  1365. Data 95,100,78
  1366. Data 95,120,60
  1367. Data 95,140,42
  1368. Data 88,160,60
  1369. Data 95,180,78
  1370. Data 95,200,60
  1371. Data 95,220,42
  1372. ; * Level35 *
  1373. Data 7 ; num_baddies
  1374. Data 4 ; baddie_speed
  1375. Data 5 ; attack_mood
  1376. Data 10 ; drop_time
  1377. Data 90,120,60
  1378. Data 92,140,78
  1379. Data 91,140,60
  1380. Data 94,160,42
  1381. Data 91,180,60
  1382. Data 92,180,78
  1383. Data 90,200,60
  1384. ; * Level36 *
  1385. Data 7 ; num_baddies
  1386. Data 4 ; baddie_speed
  1387. Data 5 ; attack_mood
  1388. Data 50 ; drop_time
  1389. Data 94,140,50
  1390. Data 94,160,50
  1391. Data 94,180,50
  1392. Data 93,130,70
  1393. Data 93,150,70
  1394. Data 93,170,70
  1395. Data 93,190,70
  1396. ; * Level37 *
  1397. Data 7 ; num_baddies
  1398. Data 4 ; baddie_speed
  1399. Data 6 ; attack_mood
  1400. Data 40 ; drop_time
  1401. Data 95,140,42
  1402. Data 90,140,60
  1403. Data 95,140,78
  1404. Data 90,160,78
  1405. Data 95,180,42
  1406. Data 90,180,60
  1407. Data 95,180,78
  1408. ; * Level38 *
  1409. Data 6 ; num_baddies
  1410. Data 4 ; baddie_speed
  1411. Data 6 ; attack_mood
  1412. Data 30 ; drop_time
  1413. Data 91,130,60
  1414. Data 91,140,42
  1415. Data 91,140,78
  1416. Data 92,180,42
  1417. Data 92,193,60
  1418. Data 92,180,78
  1419. ; * Level39 *
  1420. Data 7 ; num_baddies
  1421. Data 4 ; baddie_speed
  1422. Data 7 ; attack_mood
  1423. Data 20 ; drop_time
  1424. Data 92,140,42
  1425. Data 92,160,42
  1426. Data 92,180,42
  1427. Data 93,140,60
  1428. Data 93,160,60
  1429. Data 93,180,60
  1430. Data 95,160,78
  1431. ; * Level40 *
  1432. Data 7 ; num_baddies
  1433. Data 4 ; baddie_speed
  1434. Data 7 ; attack_mood
  1435. Data 10 ; drop_time
  1436. Data 87,130,42
  1437. Data 87,150,42
  1438. Data 87,170,42
  1439. Data 87,190,42
  1440. Data 91,160,60
  1441. Data 88,140,78
  1442. Data 88,180,78
  1443. ; * Level41 *
  1444. Data 7 ; num_baddies
  1445. Data 5 ; baddie_speed
  1446. Data 5 ; attack_mood
  1447. Data 50 ; drop_time
  1448. Data 90,100,78
  1449. Data 90,120,60
  1450. Data 90,140,42
  1451. Data 90,160,60
  1452. Data 90,180,78
  1453. Data 90,200,60
  1454. Data 90,220,42
  1455. ; * Level42 *
  1456. Data 7 ; num_baddies
  1457. Data 5 ; baddie_speed
  1458. Data 10 ; attack_mood
  1459. Data 40 ; drop_time
  1460. Data 93,140,42
  1461. Data 93,180,78
  1462. Data 87,200,60
  1463. Data 87,220,42
  1464. Data 92,100,42
  1465. Data 92,120,60
  1466. Data 92,140,78
  1467. ; * Level43 *
  1468. Data 7 ; num_baddies
  1469. Data 5 ; baddie_speed
  1470. Data 10 ; attack_mood
  1471. Data 30 ; drop_time
  1472. Data 93,140,78
  1473. Data 93,180,42
  1474. Data 87,200,60
  1475. Data 87,220,78
  1476. Data 92,100,78
  1477. Data 92,120,60
  1478. Data 92,140,42
  1479. ; * Level44 *
  1480. Data 7 ; num_baddies
  1481. Data 5 ; baddie_speed
  1482. Data 15 ; attack_mood
  1483. Data 20 ; drop_time
  1484. Data 95,100,42
  1485. Data 95,120,60
  1486. Data 95,140,78
  1487. Data 88,160,60
  1488. Data 95,180,42
  1489. Data 95,200,60
  1490. Data 95,220,78
  1491. ; * Level45 *
  1492. Data 7 ; num_baddies
  1493. Data 5 ; baddie_speed
  1494. Data 15 ; attack_mood
  1495. Data 10 ; drop_time
  1496. Data 93,100,60
  1497. Data 94,140,60
  1498. Data 94,160,42
  1499. Data 94,160,60
  1500. Data 94,160,78
  1501. Data 94,180,60
  1502. Data 93,220,60
  1503. ; * Level46 *
  1504. Data 6 ; num_baddies
  1505. Data 5 ; baddie_speed
  1506. Data 20 ; attack_mood
  1507. Data 10 ; drop_time
  1508. Data 93,120,50
  1509. Data 93,140,50
  1510. Data 94,120,70
  1511. Data 93,180,50
  1512. Data 93,200,50
  1513. Data 94,200,70
  1514. ; * Level47 *
  1515. Data 6 ; num_baddies
  1516. Data 5 ; baddie_speed
  1517. Data 30 ; attack_mood
  1518. Data 20 ; drop_time
  1519. Data 95,120,60
  1520. Data 90,150,60
  1521. Data 90,150,78
  1522. Data 90,170,60
  1523. Data 90,170,78
  1524. Data 95,200,60
  1525. ; * Level48 *
  1526. Data 7 ; num_baddies
  1527. Data 5 ; baddie_speed
  1528. Data 40 ; attack_mood
  1529. Data 10; drop_time
  1530. Data 91,120,42
  1531. Data 91,120,78
  1532. Data 87,140,60
  1533. Data 87,160,78
  1534. Data 87,180,60
  1535. Data 92,200,42
  1536. Data 92,200,78
  1537. ; * Level49 *
  1538. Data 6 ; num_baddies
  1539. Data 5 ; baddie_speed
  1540. Data 60 ; attack_mood
  1541. Data 5 ; drop_time
  1542. Data 92,100,70
  1543. Data 93,140,50
  1544. Data 93,140,70
  1545. Data 94,180,50
  1546. Data 94,180,70
  1547. Data 95,220,70
  1548. ; * Level50 *
  1549. Data 7 ; num_baddies
  1550. Data 5 ; baddie_speed
  1551. Data 70 ; attack_mood
  1552. Data 1 ; drop_time
  1553. Data 95,100,42
  1554. Data 95,160,42
  1555. Data 95,220,42
  1556. Data 95,120,60
  1557. Data 95,160,60
  1558. Data 95,200,60
  1559. Data 95,160,78
  1560. Return
  1561.  
  1562. ; Clear lives and score-indicators on bitmap 0 and 1
  1563. ; --------------------------------------------------
  1564.  
  1565. clear_stuff
  1566. For t=0 To 1
  1567.   Use BitMap t
  1568.   Boxf 11,68,27,76,0     ; Just draw some black filled boxes
  1569.   Boxf 179,184,261,192,0
  1570. Next t
  1571. Return
  1572.  
  1573. ; Initialise hiscores
  1574. ; -------------------
  1575.  
  1576. init_hiscores
  1577.   Restore INIT_DATA  ; This hiscore table is displayed every time
  1578.   For t=1 To hitot   ; you have booted up this game
  1579.     Read hiname$(t),hiscore(t)
  1580.   Next t
  1581.  
  1582.   INIT_DATA
  1583.   Data$ "MATTHIJS  "
  1584.   Data.l 10000
  1585.   Data$ "PAUL      "
  1586.   Data.l 9000
  1587.   Data$ "NOL       "
  1588.   Data.l 8000
  1589.   Data$ "GUIDO     "
  1590.   Data.l 7000
  1591.   Data$ "RENE      "
  1592.   Data.l 6000
  1593.   Data$ "FRANK     "
  1594.   Data.l 5000
  1595.   Data$ "BING BONG "
  1596.   Data.l 4000
  1597.   Data$ "SCHREUT   "
  1598.   Data.l 3000
  1599.   Data$ "MUM       "
  1600.   Data.l 2000
  1601.   Data$ "DAD       "
  1602.   Data.l 1000
  1603. Return
  1604.  
  1605. ; Handle hiscore-routines
  1606. ; -----------------------
  1607.  
  1608. .hiscores
  1609.   hinr=0           ; Check if you have got a hiscore
  1610.   For t=1 To hitot
  1611.     If score=>hiscore(t) Then hinr=t : Pop For : Goto CON0
  1612.   Next t
  1613.  
  1614.   CON0
  1615.   If hinr<>0                    ; You've got a hiscore
  1616.     For t=hitot To hinr Step -1 ; Move other scores down
  1617.       hiscore(t)=hiscore(t-1)
  1618.       hiname$(t)=hiname$(t-1)
  1619.     Next t
  1620.     hiscore(hinr)=score ; Insert yours in the array
  1621.     hiname$(hinr)=""
  1622.     Gosub SHOWHISCORES ; Show hiscores and...
  1623.     Gosub ENTERNAME    ; ...ask for your name
  1624.     Goto intro         ; Return to intro
  1625.   Else
  1626.     Goto intro ; You've got no hiscore, so return to intro
  1627.   EndIf
  1628.  
  1629. ; Enter name (belongs to Hiscore routines)
  1630. ; ----------------------------------------
  1631.  
  1632. ENTERNAME
  1633.   name$=""       ; Reset name, position and colour
  1634.   pos=0
  1635.   Colour 47+hinr
  1636.  
  1637.   START_INPT
  1638.   k$=""
  1639.   BlitzKeys Off ; Kind of primitive way to clear keyboard
  1640.   BlitzKeys On  ; buffer, but it works (with no buffer clearing, you would see all the P's you had pressed for Pause-mode)
  1641.   Repeat
  1642.     k$=UCase$(Inkey$) ; Wait for input from keyboard
  1643.     If Joyb(1)=1 Then Goto FINISHED_INPT ; or joystick (Fire)
  1644.   Until k$<>""
  1645.   kk=Asc(k$)
  1646.   If kk=13 Then Goto FINISHED_INPT ; Return
  1647.   If kk=32 Then Goto DISPLAY_INPT  ; Space
  1648.   If kk=8 Then Goto BACKSPACE      ; Backspace (really?)
  1649.   If kk<65 OR kk>91 Then Goto START_INPT ; No valid key
  1650.  
  1651.   DISPLAY_INPT ; Add input to name string
  1652.   If pos<mxlen ; only add if position is less than mxlen
  1653.     pos+1
  1654.     name$+k$
  1655.   Else
  1656.     pos=mxlen
  1657.     name$=Left$(name$,mxlen-1)+k$
  1658.   EndIf
  1659.  
  1660.   DISPLAY2     ; Show name string
  1661.   VWait
  1662.   Locate 10,7+hinr
  1663.   NPrint String$(" ",mxlen)
  1664.   Locate 10,7+hinr
  1665.   NPrint name$
  1666.   Goto START_INPT
  1667.  
  1668.   BACKSPACE ; Backspace
  1669.   If pos>0  ; If position is not 0 then remove last character
  1670.     pos-1   ; from string
  1671.   Else
  1672.     pos=0
  1673.   EndIf
  1674.   name$=Left$(name$,pos)
  1675.   Goto DISPLAY2
  1676.  
  1677.   FINISHED_INPT       ; Return was pressed, input is finished
  1678.   hiname$(hinr)=name$ ; Add name to hiscore array
  1679. Return
  1680.  
  1681. ; Show hiscores
  1682. ; -------------
  1683.  
  1684. SHOWHISCORES
  1685.   DisplayBitMap 0,4 ; Show intro screen (or empty screen)
  1686.   Use BitMap 3      ; Draw hiscore table on bitmap 3
  1687.   Boxf 58,16,260,164,0 ; Clear center of screen
  1688.   Line 57,22,57,158,0
  1689.   Line 261,22,261,158,0
  1690.   Line 56,25,56,155,0
  1691.   Line 262,25,262,155,0
  1692.   BitMapOutput 3
  1693.  
  1694.   Colour 1,0
  1695.   Locate 11,4.5
  1696.   NPrint "TODAY'S HIGHSCORES"
  1697.  
  1698.   For t=1 To hitot
  1699.     Colour 47+t
  1700.     Locate 10,7+t
  1701.     NPrint hiname$(t)
  1702.     hs$=Str$(hiscore(t))
  1703.     temp=Len(hs$)
  1704.     hs$=String$(" ",mxlen-temp)+hs$
  1705.     Locate 20,7+t
  1706.     NPrint hs$
  1707.   Next t
  1708.  
  1709.   DisplayBitMap 0,3 ; And show this bitmap
  1710. Return
  1711.  
  1712. ; Show Alert for those with a Kickstart version less than 39.x
  1713. ; ------------------------------------------------------------
  1714.  
  1715. AGA_Only ; This is weird, I had to use some old AMOS-code, because I couldn't get some C-code working...
  1716.  
  1717. n$=Chr$(0)+Chr$(188)+Chr$(15)+"Sorry folks, this is an AGA-game."+Chr$(0)+Chr$(1)
  1718. n$+Chr$(0)+Chr$(136)+Chr$(30)+"You cannot play EVIL INSECTS without a machine"+Chr$(0)+Chr$(1)
  1719. n$+Chr$(0)+Chr$(196)+Chr$(39)+"with an AGA-compatible chipset."+Chr$(0)+Chr$(1)
  1720. n$+Chr$(0)+Chr$(180)+Chr$(48)+"(Such as the A1200, A4000 and CD"+Chr$(179)+Chr$(178)+")"+Chr$(0)+Chr$(1)
  1721. n$+Chr$(0)+Chr$(184)+Chr$(66)+"Press Any mousebutton to return..."+Chr$(0)+Chr$(0)
  1722.  
  1723. Reply=DisplayAlert_(0,&n$,78) ; Intuition-call
  1724. End                           ; Bail-out
  1725.  
  1726. ; Clean up and finish
  1727. ; -------------------
  1728.  
  1729. .finish
  1730. For t=0 To Maximum Shape-1 ; Return every bit of used memory
  1731.   Free Shape t             ; to system and quit
  1732. Next t
  1733. For t=0 To Maximum Sound-1
  1734.   Free Sound t
  1735. Next t
  1736. Free MedModule 0
  1737. Free BlitzFont 0
  1738. Free Palette 0
  1739. Free BitMap 0
  1740. Free BitMap 1
  1741. Free BitMap 3
  1742. Free BitMap 4
  1743. Free CopList 0
  1744. End
  1745.  
  1746. ; ** END OF SOURCE **
  1747.