Created
November 23, 2016 19:41
-
-
Save hollance/b96e009c036d2cca76c83f933a690cfd to your computer and use it in GitHub Desktop.
Really old source code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ** START OF BLITZ 2 SOURCE ** | |
; EVIL INSECTS | |
; ============ | |
; Last changed: 30-06-94 (still 45 days and then...I'm 18) | |
; Author: Matthijs Hollemans | |
; This is the CHEATMODE, type it in correctly and you will be | |
; given 9 lives! | |
; | |
; Today the world is full of evil, | |
; Today the world is mean, | |
; But in the future near, | |
; Insects will be so evil, | |
; No man has ever seen, | |
; Or dared to fear. | |
; Anyway, for anybody who is interested in a perfect example of | |
; how-not-to-code a cool game, here's the complete source of | |
; EVIL INSECTS. I have exclusively for you documented almost | |
; every single line of this source, so you probably won't have | |
; any problems understanding this code. (Hmmm) | |
; This source is about 1700 lines long, but that's mainly because | |
; of the level-definition data statements in the set_baddies part. | |
; The game displays everything with 50 frames a second. | |
; To achieve this, I had to cut down the number of enemies and | |
; also their size. Some of the shapes in the shapes-files are | |
; unused, mainly because they are ugly and I am lazy. | |
; Well, that's all I'm gonna say about this source, except for | |
; some legal stuff. You may not recompile this source and | |
; distribute it under the name EVIL INSECTS. I don't really care | |
; if you modify it somewhat and give it another name and spread | |
; it all over the world, as long as you don't say I screwed it. | |
; You may also use some parts of this source in your own programs | |
; if you like, coz I don't really care for copyrights about this | |
; code. | |
; Oh yeah, thanx to Mark Sibly and Simon Armstrong and all | |
; those dudes at ACID for creating the best Amiga programming | |
; language, BLITZ 2! (If it wasn't for them I'd still be | |
; struggling with AMOS!) | |
NoCli | |
WBStartup ; This would be user-friendly, wouldn't it? | |
SetErr: Goto finish: End SetErr ; Stupid-but-easy-error handler | |
If ExecVersion<39 Then Goto AGA_Only ; Show Alert! | |
BLITZ ; Joepie! | |
DisplayOff ; Turn off display | |
QAMIGA ; Bwerk! Just a quick leave from Blitz | |
; Initialisation | |
; -------------- | |
BitMap 0,320,200,7 ; Initialise bitmaps | |
BitMap 1,320,200,7 ; for game-play | |
BitMap 3,320,200,7 ; and bitmaps for intro | |
BitMap 4,320,200,7 ; and hiscore stuff | |
LoadBitMap 0,"GFX1",0 ; Load backdrop and palette | |
CopyBitMap 0,1 ; Make bitmaps 0 and 1 the same | |
CopyBitMap 0,3 ; Bitmap 3 looks like bitmap 0 | |
Use BitMap 3 ; (NOT !!!) | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
CopyBitMap 3,4 ; Make bitmaps 3 and 4 the same | |
LoadBlitzFont 0,"EVILINSECTS.font" ; Load font (must be in FONTS:) | |
; NOTE: The reason for the shapenumbers not starting at 0, is the | |
; fact that I had created another file which contained font shapes | |
; ,but because blitting these on screen meant an enormous | |
; decrease in speed (no more 50 frames/sec.) I dropped that file | |
; and used a BlitzFont instead. | |
LoadShapes 36,"GFX2" ; Load main character shapes | |
LoadShapes 67,"GFX3" ; Load the rest of the shapes | |
LoadSound 0,"SND1" ; Load explosion sample | |
LoadSound 1,"SND2" ; Load shooting sample | |
LoadSound 2,"SND3" ; Load main-character-is-hit sample | |
LoadSound 3,"SND4" ; Load main-character-collects-coin sample | |
LoadSound 4,"SND5" ; Load baddie-drops-projectile sample | |
LoadMedModule 0,"SND0" | |
If NTSC Then bse=44 Else bse=64 ; Screen is positioned | |
InitCopList 0,bse,200,$10007,8,128,0 ; depending on NTSC/PAL mode | |
VWait 100 ; Wait for disk-access to finish | |
BLITZ ; Yeah, hurt me, hurt me | |
CreateDisplay 0 ; Create AGA-screen (tadaa, 128 colours) | |
DisplayPalette 0,0 ; Show palette | |
BlitzKeys On ; Allow keys to be read in Blitz-mode | |
; Set hotspots | |
; ------------ | |
Restore hotspot_data | |
For t=36 To 66 ; Set main-character hot-spots | |
Read hot_x,hot_y | |
Handle t,hot_x,hot_y | |
Next t | |
hotspot_data | |
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 | |
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 | |
For t=67 To 95 ; Set other shape's hot-spots | |
MidHandle t | |
Next t | |
MidHandle 98 | |
; Set variables | |
; ------------- | |
Dim anm(79) ; Array holding main character animation data | |
Dim star_anm(20) ; Array holding star animation data | |
Dim explo_anm(20) ; Array holding explosion anim data | |
Gosub set_anim ; Jump to routine to fill above arrays | |
hitot=10 ; Number of names to store in | |
Dim hiname$(hitot),hiscore.l(hitot) ; hiscore-array | |
Gosub init_hiscores ; Init hiscores | |
mxlen=10 ; Max. length of names in hiscore-array | |
accel=.35 ; Accelleration of main character | |
friction=.4 ; Friction when slowing down | |
left_border=68 ; Borders of playing-area | |
right_border=251 | |
num_levels=50 ; Number of levels | |
max_baddies=8 ; Max.number of bad-guys per level | |
Buffer 0,16384 ; Set buffers for blitting | |
Buffer 1,16384 ; on both bitmaps 0 and 1 | |
NEWTYPE .fallingthing ; Some falling object structure | |
x.q ; X-position | |
y ; Y-position | |
vel ; Speed | |
End NEWTYPE | |
Dim List bomb.fallingthing(2) ; List of projectiles | |
DEFTYPE.fallingthing coin ; Coin-definition (= Power-up) | |
DEFTYPE.fallingthing stone ; Stone-definition | |
NEWTYPE .bad ; Baddie (or is it spelled Baddy? Who cares...) | |
x.q ; X-position | |
y ; Y-position | |
image ; What baddie looks like | |
status ; 0=Alive 2=Hit(=Dead) | |
heading ; -1=Left 1=Right | |
hit_cnt ; Counter for explosion anim | |
dropped ; True if baddie dropped projectile | |
drop_cnt ; Counter for dropped projectile | |
End NEWTYPE | |
Dim List baddie.bad(max_baddies) ; List with baddie data | |
Dim num_baddies(num_levels) ; Number of baddies in certain level | |
Dim baddie_speed(num_levels) ; Baddie-speed in certain level | |
Dim attack_mood(num_levels) ; Random seed of attack in level | |
Dim drop_time(num_levels) ; Number of frames after which a | |
; baddie may drop a projectile again | |
Dim baddie_image(num_levels,max_baddies) ; Image of bad-dudes | |
Dim baddie_initx(num_levels,max_baddies) ; Initial X-position | |
Dim baddie_inity(num_levels,max_baddies) ; Initial Y-position | |
Gosub set_baddies ; Put all baddie-data in the right arrays | |
DisplayBitMap 0,3 ; Show bitmap 3 (still empty) | |
DisplayOn ; Turn on display | |
; Intro | |
; ----- | |
.intro | |
Gosub clear_stuff ; Clear indicators | |
StartMedModule 0 ; Start music | |
SetInt 5 ; Use VBlank interrupt to play music | |
PlayMed | |
End SetInt | |
VWait 25 ; Wait some frames (because of the ESC-key, that's why!) | |
Repeat | |
Use BitMap 4 ; Put intro info on bitmap 4 | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
Blit 98,160,55 ; Put EVIL-INSECTS logo on screen | |
BitMapOutput 4 | |
Colour 48:Locate 10,12 ; Print some info about me (hehe) | |
NPrint "Fantasy Freaks @1994" | |
Colour 51:Locate 15,14 | |
NPrint "Created by" | |
Colour 54:Locate 11,15 | |
NPrint "Matthijs Hollemans" ; That's me (stupid name, huh? Well, I'm Dutch, that explains it, doesn't it?) | |
Colour 57:Locate 10,18 | |
NPrint "Press FIRE to start!" ; This is what you should do to start this magnificent game (ahum) | |
DisplayBitMap 0,4 | |
tm.l=0 | |
Repeat ; Continue after certain time or after user input | |
VWait | |
tm+1 | |
If RawStatus($45)=True ; 'ESC'ape key | |
VWait | |
Pop Repeat:Pop Repeat:Goto finish | |
EndIf | |
If Joyb(1)=1 ; Fire button (Joystick 2) | |
Pop Repeat:Pop Repeat:Goto new_game | |
EndIf | |
Until tm>500 | |
Gosub SHOWHISCORES ; Show some hiscores for a change | |
tm.l=0 | |
Repeat ; Continue again after certain time or after user input | |
VWait | |
tm+1 | |
If RawStatus($45)=True ; 'ESC'ape key | |
VWait | |
Pop Repeat:Pop Repeat:Goto finish | |
EndIf | |
If Joyb(1)=1 | |
Pop Repeat:Pop Repeat:Goto new_game | |
EndIf | |
Until tm>500 | |
Forever | |
; New game | |
; -------- | |
new_game ; A new game starts... | |
ClrInt 5 | |
StopMed ; ...but first a module stops! | |
db=0 ; Double-buffering counter | |
DisplayBitMap 0,db ; Display play-screen | |
Use BitMap 3 ; And remove intro-stuff from intro-bitmap | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
CopyBitMap 3,4 ; Make bitmaps 3 and 4 look the same | |
Colour 1,0 ; Set printing colour | |
score.l=0 ; Your score | |
lives=4 ; The number of lives you have left | |
you_x.w=160 ; Main character X-position | |
level=0 ; First level (how obvious...) | |
coin\x=0,0,0 ; Reset coin-data | |
coin_type=0 ; What coin does. 1=Extra life 2=Speed up 3=Stone speed | |
stone\x=0,0,2 ; Reset stone-data | |
max_speed=3 ; Maximum speed of main dude | |
last_moved=0 ; Previous direction of movement (-1,1) | |
; New Level | |
; --------- | |
new_level ; Gosh, a new level | |
ClearList bomb() ; Remove all projeciles (bombs) from list | |
ClearList baddie() ; Remove all bad-guys from their list | |
no_coin=True ; True if no coin has fallen | |
no_stone=True ; True if no stone is falling | |
image=no_move_image ; Reset main character anim | |
level+1 ; Increase level-counter | |
If level>num_levels Then Goto game_completed | |
ResetList baddie() ; Init baddies for this level | |
For t=0 To num_baddies(level)-1 | |
If AddItem(baddie()) | |
baddie()\image=baddie_image(level,t) | |
baddie()\x=baddie_initx(level,t) | |
baddie()\y=baddie_inity(level,t) | |
baddie()\heading=-1 | |
baddie()\status=0 | |
EndIf | |
Next t | |
For t=0 To 1 | |
; Print number of lives , just for the good looks... | |
BitMapOutput t | |
Locate 2,8.65 | |
Print lives | |
; Print score | |
Locate 23,23.2 | |
Print score | |
Next t | |
; Init Fleet | |
; ---------- | |
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...) | |
For star_step=0 To 6 ; Star anim-frames | |
For funky=0 To 2 ; Waiting loop | |
VWait | |
DisplayBitMap 0,db ; | |
db=1-db ; Double buffering stuff | |
Use BitMap db ; | |
UnBuffer db | |
BBlit db,anm(image),you_x,129 ; Draw main character | |
ResetList baddie() | |
For t=0 To num_baddies(level)-1 | |
If NextItem(baddie()) | |
USEPATH baddie() | |
BBlit db,67+star_step,\x,\y ; Blit stars at bad-dude | |
EndIf ; locations | |
Next t | |
Next funky ; Nice variable name, ain't it? | |
Next star_step | |
you_hit=False ; You are hit if this flag sais True | |
hit_cnt=0 ; And this counter counts (syyeaaahh!) | |
UnBuffer db | |
Gosub draw_all ; Draw baddies and main character | |
DisplayBitMap 0,db ; Show it | |
VWait 50 | |
; New life | |
; -------- | |
new_life ; Something like New-Age but different | |
speed=0 ; Speed of main character | |
If no_stone=False ; Stone must keep on falling even if you died (and still have lives left, that is) | |
was_fired=True ; True if you have just fired your gun | |
Else | |
fired=False | |
EndIf | |
fire_cnt=0 ; Counter used by firing-routines | |
now_moved=0 ; Current direction of movement | |
image=no_move_image ; Current image of main character | |
already_right=False ; Has something to do with running-routines | |
already_left=False ; This one too | |
you_hit=False ; True if you are hit by projectile | |
hit_cnt=0 ; Counter if you are hit | |
; MAIN LOOP | |
; --------- | |
.main ; Inspiring label | |
Repeat | |
VWait ; | |
DisplayBitMap 0,db ; | |
db=1-db ; Do double buffering | |
Use BitMap db ; | |
UnBuffer db ; | |
If you_hit=False | |
Gosub check_stick ; Check player actions | |
Else | |
hit_cnt+1 | |
EndIf | |
Gosub baddies ; Update bad-guys | |
Gosub stones ; Handle falling-stone routines | |
Gosub bombs ; Handle projectiles | |
Gosub coin ; Handle falling coin | |
ResetList baddie() ; Check for new level (i.e. all baddies | |
nr=0 ; must be dead) | |
While NextItem(baddie()) | |
nr+1 | |
Wend | |
If nr=0 | |
Pop Repeat: Goto new_level ; New level! | |
EndIf | |
Gosub draw_all ; Update screen (blit all kinds of things) | |
If hit_cnt>17 Then Pop Repeat: Goto dead_dude ; You are one dead person | |
If RawStatus($19)=True ; <P>ause key | |
Repeat | |
VWait 10 | |
Until RawStatus($19)=True | |
VWait 10 | |
EndIf | |
If RawStatus($45)=True ; <ESC>ape key | |
UnBuffer 0 | |
UnBuffer 1 | |
Goto intro | |
EndIf | |
Forever ; There ain't no escape from the main-loop (unless the ESC-key) | |
; You have lost a life | |
; -------------------- | |
dead_dude ; Sais it all, doesn't it... | |
lives-1 ; Decrease number of lives | |
If lives<0 Then lives=0 : Goto game_over | |
max_speed-1 ; Decrease maximum speed (hehe) | |
If max_speed<3 Then max_speed=3 | |
stone\vel-1 ; This is kinda mean, but hey, nobody ever said I was a nice guy... (except for my mum) | |
If stone\vel<2 Then stone\vel=2 | |
Goto new_life ; Typical, all game coders seem to believe in re-incarnation | |
; Game completed | |
; -------------- | |
.game_completed ; I hope you won't get this far, because the well-done screen sucks (just like the rest of the game) | |
UnBuffer 0 | |
UnBuffer 1 | |
Use BitMap 3 | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
BitMapOutput 3 | |
Colour 1 | |
Locate 13,7 | |
NPrint "GAME COMPLETED" | |
Colour 51 | |
Locate 8,11 | |
NPrint "You are a most excellent" | |
Colour 54 | |
Locate 13,12 | |
NPrint "insect killer!" | |
Colour 57 | |
temp$="Your score: "+Str$(score) | |
Locate 20-Len(temp$)/2,15 | |
NPrint temp$ | |
DisplayBitMap 0,3 | |
Repeat | |
Until Joyb(1)=1 | |
VWait 10 | |
Goto hiscores | |
; Game over | |
; --------- | |
.game_over ; You will be seeing this a lot or you must be one of those dudes who cheat (lamer!) | |
UnBuffer 0 | |
UnBuffer 1 | |
ResetList baddie() ; Remove all left-over baddies | |
While NextItem(baddie()) | |
KillItem baddie() | |
Wend | |
Use BitMap 3 | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
BitMapOutput 3 | |
Colour 1 | |
Locate 15,7 | |
NPrint "GAME OVER" | |
Colour 51 | |
Locate 9,11 | |
NPrint "You are a most unlucky" | |
Colour 54 | |
Locate 13,12 | |
NPrint "insect killer!" | |
Colour 57 | |
temp$="Your score: "+Str$(score) | |
Locate 20-Len(temp$)/2,15 | |
NPrint temp$ | |
DisplayBitMap 0,3 | |
Repeat | |
Until Joyb(1)=1 | |
VWait 10 | |
Goto hiscores | |
; Check player actions | |
; -------------------- | |
.check_stick | |
If fired=True ; You have fired your gun | |
If fire_cnt=1 ; Play a nice shootin' sample | |
Sound 1,1 | |
EndIf | |
fire_cnt+1 | |
If fire_cnt<8 ; Show shooting-animation | |
image+1 | |
Else | |
If last_moved=-1 | |
image=shoot_left_end | |
Else | |
image=shoot_right_end | |
EndIf | |
EndIf | |
If fire_cnt=8 ; Initialise magic stars | |
stars=True ; and calculate the position | |
star_cnt=-1 ; where they have to show up | |
If last_moved=-1 | |
dest_x=you_x-78 | |
dest_y=15 | |
If dest_x<=left_border-13 | |
delta_x=you_x-left_border | |
dest_y=113-Int((delta_x/78)*115) | |
dest_x=left_border-13 | |
EndIf | |
Else | |
dest_x=you_x+78 | |
dest_y=15 | |
If dest_x=>right_border+12 | |
delta_x=right_border-you_x | |
dest_y=113-Int((delta_x/78)*115) | |
dest_x=right_border+12 | |
EndIf | |
EndIf | |
EndIf | |
If fire_cnt=28 | |
If dest_x<right_border+12 AND dest_x>left_border-13 | |
stone\x=dest_x,11 ; <--+ | |
no_stone=False ; | | |
EndIf ; Make stone fall from ceiling, | |
EndIf ; if maximum not reached and ceiling | |
; was hit | |
If fire_cnt=28 | |
fired=False ; Stop firing | |
speed=0 | |
was_fired=True | |
;fire_wait=0 | |
EndIf | |
Goto leave0 | |
EndIf | |
If Joyb(1)=1 AND no_stone=True ; Fire button pressed | |
fired=True | |
fire_cnt=-1 | |
If last_moved=-1 ; Calculate image | |
image=shoot_left_start | |
Else | |
image=shoot_right_start | |
EndIf | |
Goto leave0 | |
EndIf | |
now_moved=Joyx(1) ; Find out what direction user is pushing joystick in | |
If was_fired=True ; After firing, return the right | |
If now_moved=-1 ; shape | |
image=run_left_start | |
EndIf | |
If now_moved=1 | |
image=run_right_start | |
EndIf | |
If now_moved=0 | |
image=no_move_image | |
EndIf | |
was_fired=False | |
EndIf | |
If now_moved=-1 ; Joystick left | |
already_right=False ; Calculate image | |
If already_left=False | |
image=run_left_start | |
already_left=True | |
Else | |
If image<run_left_end | |
image+1 | |
Else | |
image=run_left_start | |
EndIf | |
EndIf | |
speed-accel | |
If speed<=-max_speed ; Calculate speed | |
speed=-max_speed | |
EndIf | |
you_x+speed ; Change position | |
EndIf | |
If now_moved=1 ; Joystick right | |
already_left=False ; Calculate image | |
If already_right=False | |
image=run_right_start | |
already_right=True | |
Else | |
If image<run_right_end | |
image+1 | |
Else | |
image=run_right_start | |
EndIf | |
EndIf | |
speed+accel | |
If speed>=max_speed ; Calculate speed | |
speed=max_speed | |
EndIf | |
you_x+speed ; Change position | |
EndIf | |
If now_moved=0 ; No joystick movement | |
already_right=False | |
already_left=False | |
If last_moved=-1 ; Previous direction was left | |
If image<run_left_end ; Calculate image | |
image+1 | |
Else | |
image=run_left_start | |
EndIf | |
If speed<0 ; Calculate speed | |
speed+friction | |
Else | |
speed=0 | |
EndIf | |
you_x+speed ; Calculate position | |
EndIf | |
If last_moved=1 ; Previous direction was right | |
If image<run_right_end ; Calculate image | |
image+1 | |
Else | |
image=run_right_start | |
EndIf | |
If speed>0 ; Calculate speed | |
speed-friction | |
Else | |
speed=0 | |
EndIf | |
you_x+speed ; Calculate position | |
EndIf | |
EndIf | |
If speed=0 AND now_moved=0 ; No movement image | |
image=no_move_image ; i.e. main character does not move | |
EndIf | |
If you_x<left_border ; Check left borders | |
you_x=left_border | |
speed=0 | |
EndIf | |
If you_x>right_border ; Check right border | |
you_x=right_border | |
speed=0 | |
EndIf | |
If now_moved<>0 ; Remember previous movement | |
last_moved=now_moved | |
EndIf | |
leave0 | |
Return | |
; Update screen | |
; ------------- | |
.draw_all | |
If you_hit=False | |
If fire_cnt=>3 AND fire_cnt<=12 ; Draw flame from gun | |
If last_moved=-1 | |
BBlit db,97,you_x-20,109,128 | |
Else | |
BBlit db,96,you_x+10,109,128 | |
EndIf | |
EndIf | |
EndIf | |
If you_hit=True | |
If db=0 | |
image=die_image | |
Else | |
image=no_move_image | |
EndIf | |
EndIf | |
BBlit db,anm(image),you_x,129 ; Draw main character | |
ResetList baddie() | |
While NextItem(baddie()) | |
BBlit db,baddie()\image,baddie()\x,baddie()\y ; Draw baddies | |
Wend | |
If no_coin=False | |
BBlit db,coin_image,coin\x,coin\y ; Draw coin | |
EndIf | |
If no_stone=False | |
BBlit db,81,stone\x,stone\y ; Draw stone | |
EndIf | |
ResetList bomb() | |
While NextItem(bomb()) | |
BBlit db,86,bomb()\x,bomb()\y ; Draw projectiles (= bombs) | |
Wend | |
If stars=True | |
star_cnt+1 | |
If star_cnt<20 | |
BBlit db,star_anm(star_cnt),dest_x,dest_y ; Draw magic stars | |
Else | |
stars=False | |
EndIf | |
EndIf | |
; Print number of lives | |
BitMapOutput db | |
Locate 2,8.65 | |
Print lives | |
; Print score | |
Locate 23,23.2 | |
Print score | |
Return | |
; Create animation arrays | |
; ----------------------- | |
.set_anim | |
Restore anim_data | |
For t=0 To 79 ; Main character animation array | |
Read temp | |
anm(t)=temp | |
Next t | |
anim_data | |
Data 36 ; no_move (0) | |
Data 37,37,37,37,37,38,38,38,39 ; Shoot_right (1-9) | |
Data 40,40,40,40,40,41,41,41,42 ; Shoot_left (10-18) | |
Data 43,43,43,44,44,44,45,45,45,46 ; Run_right | |
Data 46,46,47,47,47,48,48,48,49,49 ; (19-48) | |
Data 49,50,50,50,51,51,51,52,52,52 ; | |
Data 53,53,53,54,54,54,55,55,55,56 ; Run_left | |
Data 56,56,57,57,57,58,58,58,59,59 ; (49-78) | |
Data 59,60,60,60,61,61,61,62,62,62 ; | |
Data 63 ; Die_image (79) | |
run_right_start=19 ; Some variables containing start and end | |
run_right_end=48 ; positions of some anims in the anm()-array | |
run_left_start=49 | |
run_left_end=78 | |
die_image=79 | |
shoot_right_start=1 | |
shoot_right_end=9 | |
shoot_left_start=10 | |
shoot_left_end=18 | |
no_move_image=0 | |
Restore star_data | |
For t=0 To 20 ; Magic stars animation array | |
Read temp | |
star_anm(t)=temp | |
Next t | |
star_data | |
Data 67,67,67,68,68,68,69,69,69 | |
Data 70,70,70,71,71,71,72,72,72 | |
Data 73,73,73 | |
Restore explo_data ; Explosion animation array | |
For t=0 To 20 | |
Read temp | |
explo_anm(t)=temp | |
Next t | |
explo_data | |
Data 74,74,74,75,75,75,76,76,76 | |
Data 77,77,77,78,78,78,79,79,79 | |
Data 80,80,80 | |
Return | |
; Handle falling stones | |
; --------------------- | |
.stones | |
If no_stone=False ; Only do the following if a stone is falling | |
stone\y+stone\vel ; Update positions | |
If stone\y>162 ; Check if stone doesn't fall through floor | |
no_stone=True | |
Else | |
ResetList baddie() ; Check for baddie-hit | |
While NextItem(baddie()) | |
If baddie()\status<>2 ; Don't check for hit if baddie is already hit | |
If ShapesHit(81,stone\x,stone\y,baddie()\image,baddie()\x,baddie()\y)=True ; Yikes! | |
baddie()\status=2 | |
baddie()\hit_cnt=-1 ; Baddie is hit | |
no_stone=True | |
score+(baddie()\image-86)*100 ; Add score to keep player happy | |
If score>999999999 Then score=999999999 | |
Sound 0,2 ; Play sample | |
Pop While : Goto nex2 | |
EndIf | |
EndIf | |
Wend | |
EndIf | |
EndIf | |
nex2 | |
Return | |
; Handle projectiles dropped by baddies | |
; ------------------------------------- | |
.bombs | |
; Update positions | |
ResetList bomb() | |
While NextItem(bomb()) | |
USEPATH bomb() | |
\y+\vel ; Update positions | |
If \y>162 ; Check if bomb doesn't fall through floor | |
KillItem bomb() | |
Else | |
If RectsHit(\x-3,\y-2,6,4,you_x-10,124,18,41) ; Check for player-hit | |
you_hit=True ; Main character is hit | |
Sound 2,4 ; And you can hear it too | |
KillItem bomb() ; Projectile disappears | |
Pop While: Goto nex1 | |
EndIf | |
EndIf | |
Wend | |
nex1 | |
If you_hit=True ; If you are hit, all other projectiles | |
ResetList bomb() ; also disappear | |
While NextItem(bomb()) | |
KillItem bomb() | |
Wend | |
EndIf | |
Return | |
; Handle baddies | |
; -------------- | |
.baddies | |
ResetList baddie() | |
While NextItem(baddie()) | |
USEPATH baddie() | |
\x+\heading*baddie_speed(level) ; Update position | |
If \x<left_border ; Check left border | |
\x=left_border | |
\heading=1 ; Adapt heading | |
EndIf | |
If \x>right_border ; Check right border | |
\x=right_border | |
\heading=-1 ; Adapt heading | |
EndIf | |
If \dropped=True ; Increase drop counter if dropped | |
\drop_cnt+1 | |
EndIf | |
If \drop_cnt>drop_time(level) ; Baddie may drop again if drop counter is more than drop_time(level) | |
\dropped=False | |
EndIf | |
If \status<>2 ; Baddie can only drop if he's not hit and he has not dropped a projectile yet | |
If \dropped=False | |
If Int(Rnd(1000))<attack_mood(level) ; Only drop if in attack mood (just a random number) | |
If AddItem(bomb()) | |
\dropped=True | |
Sound 4,8 ; Just a little bit of SFX | |
\drop_cnt=0 | |
bomb()\x=baddie()\x,baddie()\y+10,Int(Rnd(3))+1 ; Speed of bomb is random (just for the hell of it...) | |
EndIf | |
EndIf | |
EndIf | |
Else | |
\hit_cnt+1 ; If baddie is hit, then increase hit counter... | |
If \hit_cnt<21 | |
baddie()\image=explo_anm(\hit_cnt) ; ...and update explosion frame number | |
Else ; Hit counter is more than 21 now, so... | |
If no_coin=True ; ...if no coin is falling right now, | |
If Int(Rnd(16))=1 ; then drop coin if random check=ok | |
coin\x=baddie()\x,baddie()\y,2 | |
coin_type=Int(Rnd(3))+1 ; Coin type is determined by random function | |
If coin_type=1 Then coin_image=82 ; Find out what image belongs to coin type | |
If coin_type=2 Then coin_image=85 | |
If coin_type=3 Then coin_image=84 | |
no_coin=False ; Set flag that a coin is falling | |
EndIf | |
EndIf | |
KillItem baddie() ; Remove baddie from list | |
EndIf | |
EndIf | |
Wend | |
Return | |
; Handle falling coin | |
; ------------------- | |
.coin | |
If no_coin=False ; Only do the following if coin is falling | |
USEPATH coin | |
\y+\vel ; Change position | |
If \y>159 Then no_coin=True ; until coin hits the floor | |
If RectsHit(coin\x-5,coin\y-5,10,10,you_x-10,124,18,41) ; Check for a coin-main dude hit | |
no_coin=True | |
Sound 3,1 ; Player picked up coin, play sample (Hurray...) | |
If coin_type=1 ; Extra life-coin | |
lives+1:score+250 ; Add life and score | |
If lives>9 Then lives=9 | |
EndIf | |
If coin_type=2 ; Extra speed-coin | |
max_speed+1: score+150 ; Add speed and score | |
If max_speed>6 Then max_speed=6 | |
EndIf | |
If coin_type=3 ; Extra stone-speed-coin | |
stone\vel+1:score+200 ; Add stone-speed and score | |
If stone\vel>5 Then stone\vel=5 | |
EndIf | |
EndIf | |
EndIf | |
Return | |
; Initialise baddies for every level | |
; ---------------------------------- | |
.set_baddies | |
Restore baddie_data | |
For t=1 To num_levels ; Read the following stuff in some arrays | |
Read num_baddies(t) ; (explanation of these in the Initialise | |
Read baddie_speed(t) ; section of this source) | |
Read attack_mood(t) | |
Read drop_time(t) | |
For u=0 To num_baddies(t)-1 | |
Read baddie_image(t,u) | |
Read baddie_initx(t,u) | |
Read baddie_inity(t,u) | |
Next u | |
Next t | |
baddie_data ; These are a lot of data-statements containing | |
; * Level1 * ; initial coordinates and all (50 levels!) | |
Data 3 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 1 ; attack_mood | |
Data 50 ; drop_time | |
Data 87,130,60 | |
Data 87,160,60 | |
Data 87,190,60 | |
; * Level2 * | |
Data 5 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 2 ; attack_mood | |
Data 75 ; drop_time | |
Data 87,120,60 | |
Data 87,140,60 | |
Data 87,160,60 | |
Data 87,180,60 | |
Data 87,200,60 | |
; * Level3 * | |
Data 4 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 30 ; drop_time | |
Data 88,130,60 | |
Data 87,150,60 | |
Data 87,170,60 | |
Data 88,190,60 | |
; * Level4 * | |
Data 7 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 20 ; drop_time | |
Data 88,120,60 | |
Data 87,140,50 | |
Data 87,140,70 | |
Data 88,160,60 | |
Data 87,180,50 | |
Data 87,180,70 | |
Data 88,200,60 | |
; * Level5 * | |
Data 6 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 10 ; drop_time | |
Data 90,110,60 | |
Data 88,130,60 | |
Data 87,150,60 | |
Data 87,170,60 | |
Data 88,190,60 | |
Data 90,210,60 | |
; * Level6 * | |
Data 6 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 50 ; drop_time | |
Data 90,131,50 | |
Data 88,150,50 | |
Data 87,150,70 | |
Data 87,170,70 | |
Data 88,170,50 | |
Data 90,190,50 | |
; * Level7 * | |
Data 7 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 40 ; drop_time | |
Data 88,130,42 | |
Data 88,130,60 | |
Data 88,130,78 | |
Data 90,160,60 | |
Data 88,190,42 | |
Data 88,190,60 | |
Data 88,190,78 | |
; * Level8 * | |
Data 7 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 30 ; drop_time | |
Data 91,120,50 | |
Data 91,120,70 | |
Data 90,140,60 | |
Data 88,160,60 | |
Data 90,180,60 | |
Data 91,200,50 | |
Data 91,200,70 | |
; * Level9 * | |
Data 7 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 20 ; drop_time | |
Data 91,120,50 | |
Data 87,120,70 | |
Data 90,140,60 | |
Data 88,160,70 | |
Data 90,180,60 | |
Data 91,200,50 | |
Data 87,200,70 | |
; * Level10 * | |
Data 7 ; num_baddies | |
Data 1 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 10 ; drop_time | |
Data 91,110,42 | |
Data 90,130,60 | |
Data 88,150,78 | |
Data 87,160,42 | |
Data 88,170,78 | |
Data 90,190,60 | |
Data 91,210,42 | |
; * Level11 * | |
Data 3 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 2 ; attack_mood | |
Data 50 ; drop_time | |
Data 90,140,42 | |
Data 90,160,60 | |
Data 90,180,78 | |
; * Level12 * | |
Data 5 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 2 ; attack_mood | |
Data 40 ; drop_time | |
Data 91,120,42 | |
Data 91,140,60 | |
Data 92,160,78 | |
Data 91,180,60 | |
Data 91,200,42 | |
; * Level13 * | |
Data 5 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 30 ; drop_time | |
Data 90,120,78 | |
Data 91,140,60 | |
Data 92,160,42 | |
Data 91,180,60 | |
Data 90,200,78 | |
; * Level14 * | |
Data 6 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 20 ; drop_time | |
Data 92,120,78 | |
Data 91,140,60 | |
Data 90,160,42 | |
Data 92,160,78 | |
Data 91,180,60 | |
Data 90,200,42 | |
; * Level15 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 10 ; drop_time | |
Data 88,110,50 | |
Data 91,130,50 | |
Data 90,130,70 | |
Data 87,160,50 | |
Data 91,190,50 | |
Data 90,190,70 | |
Data 88,210,50 | |
; * Level16 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 50 ; drop_time | |
Data 92,120,50 | |
Data 88,140,50 | |
Data 90,150,70 | |
Data 91,160,50 | |
Data 91,170,70 | |
Data 88,180,50 | |
Data 92,200,50 | |
; * Level17 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 40 ; drop_time | |
Data 87,130,42 | |
Data 92,130,60 | |
Data 91,130,78 | |
Data 93,160,78 | |
Data 91,190,78 | |
Data 92,190,60 | |
Data 87,190,42 | |
; * Level18 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 30 ; drop_time | |
Data 87,110,50 | |
Data 92,110,70 | |
Data 91,130,60 | |
Data 93,160,60 | |
Data 91,190,60 | |
Data 87,210,50 | |
Data 92,210,70 | |
; * Level19 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 20 ; drop_time | |
Data 92,120,42 | |
Data 92,120,60 | |
Data 92,120,78 | |
Data 93,160,60 | |
Data 94,200,42 | |
Data 94,200,60 | |
Data 94,200,78 | |
; * Level20 * | |
Data 7 ; num_baddies | |
Data 2 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 10 ; drop_time | |
Data 93,130,50 | |
Data 93,150,50 | |
Data 93,170,50 | |
Data 93,190,50 | |
Data 94,140,70 | |
Data 94,160,70 | |
Data 94,180,70 | |
; * Level21 * | |
Data 3 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 2 ; attack_mood | |
Data 50 ; drop_time | |
Data 93,180,42 | |
Data 94,160,60 | |
Data 92,140,78 | |
; * Level22 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 2 ; attack_mood | |
Data 40 ; drop_time | |
Data 91,100,42 | |
Data 92,120,60 | |
Data 93,140,78 | |
Data 87,160,60 | |
Data 93,180,78 | |
Data 92,200,60 | |
Data 91,220,42 | |
; * Level23 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 30 ; drop_time | |
Data 90,100,78 | |
Data 91,120,60 | |
Data 92,140,42 | |
Data 88,160,60 | |
Data 92,180,42 | |
Data 91,200,60 | |
Data 90,220,78 | |
; * Level24 * | |
Data 6 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 20 ; drop_time | |
Data 92,120,42 | |
Data 91,140,60 | |
Data 90,160,78 | |
Data 92,160,42 | |
Data 91,180,60 | |
Data 90,200,78 | |
; * Level25 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 10 ; drop_time | |
Data 88,110,70 | |
Data 91,130,70 | |
Data 90,130,50 | |
Data 87,160,70 | |
Data 91,190,70 | |
Data 90,190,50 | |
Data 88,210,70 | |
; * Level26 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 50 ; drop_time | |
Data 92,120,70 | |
Data 88,140,70 | |
Data 90,140,50 | |
Data 91,160,70 | |
Data 88,180,70 | |
Data 90,180,50 | |
Data 92,200,70 | |
; * Level27 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 40 ; drop_time | |
Data 87,130,78 | |
Data 92,130,60 | |
Data 91,130,42 | |
Data 93,160,42 | |
Data 91,190,42 | |
Data 92,190,60 | |
Data 87,190,78 | |
; * Level28 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 30 ; drop_time | |
Data 90,120,60 | |
Data 92,140,42 | |
Data 91,140,60 | |
Data 94,160,78 | |
Data 91,180,60 | |
Data 92,180,42 | |
Data 90,200,60 | |
; * Level29 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 20 ; drop_time | |
Data 92,120,42 | |
Data 92,120,60 | |
Data 92,120,78 | |
Data 93,160,60 | |
Data 94,200,42 | |
Data 94,200,60 | |
Data 94,200,78 | |
; * Level30 * | |
Data 7 ; num_baddies | |
Data 3 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 10 ; drop_time | |
Data 87,120,60 | |
Data 88,140,42 | |
Data 90,140,78 | |
Data 88,160,42 | |
Data 90,160,78 | |
Data 88,180,42 | |
Data 90,180,78 | |
Return | |
; * Level31 * | |
Data 5 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 50 ; drop_time | |
Data 93,140,42 | |
Data 93,140,78 | |
Data 94,160,60 | |
Data 95,180,78 | |
Data 95,180,42 | |
; * Level32 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 3 ; attack_mood | |
Data 40 ; drop_time | |
Data 91,130,78 | |
Data 92,110,60 | |
Data 93,130,42 | |
Data 87,160,42 | |
Data 93,190,42 | |
Data 92,210,60 | |
Data 91,190,78 | |
; * Level33 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 30 ; drop_time | |
Data 91,130,42 | |
Data 92,110,60 | |
Data 93,130,78 | |
Data 87,160,78 | |
Data 93,190,78 | |
Data 92,210,60 | |
Data 91,190,42 | |
; * Level34 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 4 ; attack_mood | |
Data 20 ; drop_time | |
Data 95,100,78 | |
Data 95,120,60 | |
Data 95,140,42 | |
Data 88,160,60 | |
Data 95,180,78 | |
Data 95,200,60 | |
Data 95,220,42 | |
; * Level35 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 10 ; drop_time | |
Data 90,120,60 | |
Data 92,140,78 | |
Data 91,140,60 | |
Data 94,160,42 | |
Data 91,180,60 | |
Data 92,180,78 | |
Data 90,200,60 | |
; * Level36 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 50 ; drop_time | |
Data 94,140,50 | |
Data 94,160,50 | |
Data 94,180,50 | |
Data 93,130,70 | |
Data 93,150,70 | |
Data 93,170,70 | |
Data 93,190,70 | |
; * Level37 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 40 ; drop_time | |
Data 95,140,42 | |
Data 90,140,60 | |
Data 95,140,78 | |
Data 90,160,78 | |
Data 95,180,42 | |
Data 90,180,60 | |
Data 95,180,78 | |
; * Level38 * | |
Data 6 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 6 ; attack_mood | |
Data 30 ; drop_time | |
Data 91,130,60 | |
Data 91,140,42 | |
Data 91,140,78 | |
Data 92,180,42 | |
Data 92,193,60 | |
Data 92,180,78 | |
; * Level39 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 7 ; attack_mood | |
Data 20 ; drop_time | |
Data 92,140,42 | |
Data 92,160,42 | |
Data 92,180,42 | |
Data 93,140,60 | |
Data 93,160,60 | |
Data 93,180,60 | |
Data 95,160,78 | |
; * Level40 * | |
Data 7 ; num_baddies | |
Data 4 ; baddie_speed | |
Data 7 ; attack_mood | |
Data 10 ; drop_time | |
Data 87,130,42 | |
Data 87,150,42 | |
Data 87,170,42 | |
Data 87,190,42 | |
Data 91,160,60 | |
Data 88,140,78 | |
Data 88,180,78 | |
; * Level41 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 5 ; attack_mood | |
Data 50 ; drop_time | |
Data 90,100,78 | |
Data 90,120,60 | |
Data 90,140,42 | |
Data 90,160,60 | |
Data 90,180,78 | |
Data 90,200,60 | |
Data 90,220,42 | |
; * Level42 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 10 ; attack_mood | |
Data 40 ; drop_time | |
Data 93,140,42 | |
Data 93,180,78 | |
Data 87,200,60 | |
Data 87,220,42 | |
Data 92,100,42 | |
Data 92,120,60 | |
Data 92,140,78 | |
; * Level43 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 10 ; attack_mood | |
Data 30 ; drop_time | |
Data 93,140,78 | |
Data 93,180,42 | |
Data 87,200,60 | |
Data 87,220,78 | |
Data 92,100,78 | |
Data 92,120,60 | |
Data 92,140,42 | |
; * Level44 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 15 ; attack_mood | |
Data 20 ; drop_time | |
Data 95,100,42 | |
Data 95,120,60 | |
Data 95,140,78 | |
Data 88,160,60 | |
Data 95,180,42 | |
Data 95,200,60 | |
Data 95,220,78 | |
; * Level45 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 15 ; attack_mood | |
Data 10 ; drop_time | |
Data 93,100,60 | |
Data 94,140,60 | |
Data 94,160,42 | |
Data 94,160,60 | |
Data 94,160,78 | |
Data 94,180,60 | |
Data 93,220,60 | |
; * Level46 * | |
Data 6 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 20 ; attack_mood | |
Data 10 ; drop_time | |
Data 93,120,50 | |
Data 93,140,50 | |
Data 94,120,70 | |
Data 93,180,50 | |
Data 93,200,50 | |
Data 94,200,70 | |
; * Level47 * | |
Data 6 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 30 ; attack_mood | |
Data 20 ; drop_time | |
Data 95,120,60 | |
Data 90,150,60 | |
Data 90,150,78 | |
Data 90,170,60 | |
Data 90,170,78 | |
Data 95,200,60 | |
; * Level48 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 40 ; attack_mood | |
Data 10; drop_time | |
Data 91,120,42 | |
Data 91,120,78 | |
Data 87,140,60 | |
Data 87,160,78 | |
Data 87,180,60 | |
Data 92,200,42 | |
Data 92,200,78 | |
; * Level49 * | |
Data 6 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 60 ; attack_mood | |
Data 5 ; drop_time | |
Data 92,100,70 | |
Data 93,140,50 | |
Data 93,140,70 | |
Data 94,180,50 | |
Data 94,180,70 | |
Data 95,220,70 | |
; * Level50 * | |
Data 7 ; num_baddies | |
Data 5 ; baddie_speed | |
Data 70 ; attack_mood | |
Data 1 ; drop_time | |
Data 95,100,42 | |
Data 95,160,42 | |
Data 95,220,42 | |
Data 95,120,60 | |
Data 95,160,60 | |
Data 95,200,60 | |
Data 95,160,78 | |
Return | |
; Clear lives and score-indicators on bitmap 0 and 1 | |
; -------------------------------------------------- | |
clear_stuff | |
For t=0 To 1 | |
Use BitMap t | |
Boxf 11,68,27,76,0 ; Just draw some black filled boxes | |
Boxf 179,184,261,192,0 | |
Next t | |
Return | |
; Initialise hiscores | |
; ------------------- | |
init_hiscores | |
Restore INIT_DATA ; This hiscore table is displayed every time | |
For t=1 To hitot ; you have booted up this game | |
Read hiname$(t),hiscore(t) | |
Next t | |
INIT_DATA | |
Data$ "MATTHIJS " | |
Data.l 10000 | |
Data$ "PAUL " | |
Data.l 9000 | |
Data$ "NOL " | |
Data.l 8000 | |
Data$ "GUIDO " | |
Data.l 7000 | |
Data$ "RENE " | |
Data.l 6000 | |
Data$ "FRANK " | |
Data.l 5000 | |
Data$ "BING BONG " | |
Data.l 4000 | |
Data$ "SCHREUT " | |
Data.l 3000 | |
Data$ "MUM " | |
Data.l 2000 | |
Data$ "DAD " | |
Data.l 1000 | |
Return | |
; Handle hiscore-routines | |
; ----------------------- | |
.hiscores | |
hinr=0 ; Check if you have got a hiscore | |
For t=1 To hitot | |
If score=>hiscore(t) Then hinr=t : Pop For : Goto CON0 | |
Next t | |
CON0 | |
If hinr<>0 ; You've got a hiscore | |
For t=hitot To hinr Step -1 ; Move other scores down | |
hiscore(t)=hiscore(t-1) | |
hiname$(t)=hiname$(t-1) | |
Next t | |
hiscore(hinr)=score ; Insert yours in the array | |
hiname$(hinr)="" | |
Gosub SHOWHISCORES ; Show hiscores and... | |
Gosub ENTERNAME ; ...ask for your name | |
Goto intro ; Return to intro | |
Else | |
Goto intro ; You've got no hiscore, so return to intro | |
EndIf | |
; Enter name (belongs to Hiscore routines) | |
; ---------------------------------------- | |
ENTERNAME | |
name$="" ; Reset name, position and colour | |
pos=0 | |
Colour 47+hinr | |
START_INPT | |
k$="" | |
BlitzKeys Off ; Kind of primitive way to clear keyboard | |
BlitzKeys On ; buffer, but it works (with no buffer clearing, you would see all the P's you had pressed for Pause-mode) | |
Repeat | |
k$=UCase$(Inkey$) ; Wait for input from keyboard | |
If Joyb(1)=1 Then Goto FINISHED_INPT ; or joystick (Fire) | |
Until k$<>"" | |
kk=Asc(k$) | |
If kk=13 Then Goto FINISHED_INPT ; Return | |
If kk=32 Then Goto DISPLAY_INPT ; Space | |
If kk=8 Then Goto BACKSPACE ; Backspace (really?) | |
If kk<65 OR kk>91 Then Goto START_INPT ; No valid key | |
DISPLAY_INPT ; Add input to name string | |
If pos<mxlen ; only add if position is less than mxlen | |
pos+1 | |
name$+k$ | |
Else | |
pos=mxlen | |
name$=Left$(name$,mxlen-1)+k$ | |
EndIf | |
DISPLAY2 ; Show name string | |
VWait | |
Locate 10,7+hinr | |
NPrint String$(" ",mxlen) | |
Locate 10,7+hinr | |
NPrint name$ | |
Goto START_INPT | |
BACKSPACE ; Backspace | |
If pos>0 ; If position is not 0 then remove last character | |
pos-1 ; from string | |
Else | |
pos=0 | |
EndIf | |
name$=Left$(name$,pos) | |
Goto DISPLAY2 | |
FINISHED_INPT ; Return was pressed, input is finished | |
hiname$(hinr)=name$ ; Add name to hiscore array | |
Return | |
; Show hiscores | |
; ------------- | |
SHOWHISCORES | |
DisplayBitMap 0,4 ; Show intro screen (or empty screen) | |
Use BitMap 3 ; Draw hiscore table on bitmap 3 | |
Boxf 58,16,260,164,0 ; Clear center of screen | |
Line 57,22,57,158,0 | |
Line 261,22,261,158,0 | |
Line 56,25,56,155,0 | |
Line 262,25,262,155,0 | |
BitMapOutput 3 | |
Colour 1,0 | |
Locate 11,4.5 | |
NPrint "TODAY'S HIGHSCORES" | |
For t=1 To hitot | |
Colour 47+t | |
Locate 10,7+t | |
NPrint hiname$(t) | |
hs$=Str$(hiscore(t)) | |
temp=Len(hs$) | |
hs$=String$(" ",mxlen-temp)+hs$ | |
Locate 20,7+t | |
NPrint hs$ | |
Next t | |
DisplayBitMap 0,3 ; And show this bitmap | |
Return | |
; Show Alert for those with a Kickstart version less than 39.x | |
; ------------------------------------------------------------ | |
AGA_Only ; This is weird, I had to use some old AMOS-code, because I couldn't get some C-code working... | |
n$=Chr$(0)+Chr$(188)+Chr$(15)+"Sorry folks, this is an AGA-game."+Chr$(0)+Chr$(1) | |
n$+Chr$(0)+Chr$(136)+Chr$(30)+"You cannot play EVIL INSECTS without a machine"+Chr$(0)+Chr$(1) | |
n$+Chr$(0)+Chr$(196)+Chr$(39)+"with an AGA-compatible chipset."+Chr$(0)+Chr$(1) | |
n$+Chr$(0)+Chr$(180)+Chr$(48)+"(Such as the A1200, A4000 and CD"+Chr$(179)+Chr$(178)+")"+Chr$(0)+Chr$(1) | |
n$+Chr$(0)+Chr$(184)+Chr$(66)+"Press Any mousebutton to return..."+Chr$(0)+Chr$(0) | |
Reply=DisplayAlert_(0,&n$,78) ; Intuition-call | |
End ; Bail-out | |
; Clean up and finish | |
; ------------------- | |
.finish | |
For t=0 To Maximum Shape-1 ; Return every bit of used memory | |
Free Shape t ; to system and quit | |
Next t | |
For t=0 To Maximum Sound-1 | |
Free Sound t | |
Next t | |
Free MedModule 0 | |
Free BlitzFont 0 | |
Free Palette 0 | |
Free BitMap 0 | |
Free BitMap 1 | |
Free BitMap 3 | |
Free BitMap 4 | |
Free CopList 0 | |
End | |
; ** END OF SOURCE ** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment