SBP WORM.SBP - The Worm main() t  Colours$(15) Colours$(0)"0 - White" Colours$(1)"1 - Black" Colours$(2)"2 - Red" Colours$(3)"3 - Green" Colours$(4)"4 - Blue" Colours$(5)"5 - Cyan" Colours$(6)"6 - Yellow" Colours$(7)"7 - Purple" Colours$(8)"8 - Grey" Colours$(9)"9 - Dark Grey" Colours$(10)"10- Dark Red" Colours$(11)"11- Dark Green" Colours$(12)"12- Dark Blue" Colours$(13)"13- Dark Cyan" Colours$(14)"14- Dark Yellow" Colours$(15)"15- Dark Purple" dirn%%,newdirn%%,IsOff%% maxx%%,maxy%% bx%%,by%%,bw%%,bh%% nox%%,noy%%,square%% dx%%,dy%% bordw%% maxx%%sys(11)8' bodges, but I can't be bothered to read window params... maxy%%sys(12)40 WormHead%%,WormTail%%,WormTailTogo%%,WormLen%% gogogogogo%%,speed%%,defspeed%%,nos%%,maxspeed%%,maxlen%% headcolo%%,tailcolo%%,bordfg%%,bordbg%% ********************************* default values - read from INI? bordw%%32 square%%16 defspeed%%3 maxspeed%%10 nos%%3 headcolo%%3 tailcolo%%2 bordfg%%1 bordbg%%0 ********************************* default values e e 0 s2 _e188 Setup() NewGame() KeyEvent(),0 t 1 gogogogogo%%   "Play again?","",130,isok%% isok%%p NewGame() ^    MoveWorm(t&%) te newdirn%%0p dirn%%newdirn%% newdirn%%1 GetXY(xpos%%,ypos%%,Worm%%(wormhead%%)) 0,(bx%%xpos%%dx%%),(by%%ypos%%dy%%)tailcolo%% dirn%% 0:xpos%%xpos%%1' moving right 1:xpos%%xpos%%1' moving left 2:ypos%%ypos%%1' moving down 4:ypos%%ypos%%1' moving up PosMarker%%(xpos%%,ypos%%)0p 5,(bx%%xpos%%dx%%),(by%%ypos%%dy%%) WormTailTogo%%WormTailTogo%%PosMarker%%(xpos%%,ypos%%) PosMarker%%(xpos%%,ypos%%)1 SetPosMarker() PosMarker%%(xpos%%,ypos%%)0 (xpos%%0) (ypos%%0) (xpos%%nox%%) (ypos%%noy%%) PosMarker%%(xpos%%,ypos%%)p SwallowTail() ^ PosMarker%%(xpos%%,ypos%%)1 |0,(bx%%xpos%%dx%%dx%%2),(by%%ypos%%dy%%dy%%2),dx%%,dy%% 0,(bx%%xpos%%dx%%),(by%%ypos%%dy%%)headcolo%%  WormHead%%(WormHead%%1)(X(worm%%)1) Worm%%(WormHead%%)MakeXY%%(xpos%%,ypos%%) WormTailTogo%%0p WormTailTogo%%WormTailTogo%%1 WormLen%%WormLen%%1 WormLen%%Maxlen%%pMaxLen%%WormLen%% WormLen%%100p WormLen%%9speed%%p  SetSpeed(WormLen%%9)   ^ GetXY(xpos%%,ypos%%,worm%%(WormTail%%)) PosMarker%%(xpos%%,ypos%%)0 0,(bx%%xpos%%dx%%),(by%%ypos%%dy%%)  Worm%%(WormTail%%)0 WormTail%%(WormTail%%1)(X(worm%%)1)  t  KeyEvent(Qtime&%,KeyP%%,fKey$) keyp%% 27 IsOff%%1 8e  186 SwallowTail() 177' left dirn%%0pnewdirn%%1 178' right dirn%%1pnewdirn%%0 179' up dirn%%2pnewdirn%%4 180' down dirn%%4pnewdirn%%2 .("1")q.("9") SetSpeed(keyp%%.("0")) 32 IsOff%%p 8 ^ 8e  IsOff%%OIsOff%% 13 Setup() NewGame() ^ :{keyp%%  GetXY(xpos%%,ypos%%,no%%) xpos%%no%%noy%% ypos%%no%%noy%%  MakeXY%%(xpos%%,ypos%%) MakeXY%%xpos%%noy%%ypos%%  SetSpeed(sp%%) sp%%speed%% sp%% maxspeed%%p speed%%sp%% 8(0.5sp%%)MoveWorm(),,1 t  SwallowTail() te WormTail%%WormHead%% GetXY(xpos%%,ypos%%,worm%%(WormTail%%)) PosMarker%%(xpos%%,ypos%%)0 0,(bx%%xpos%%dx%%),(by%%ypos%%dy%%)  WormLen%% 10p0.1 WormTail%%(WormTail%%1)(X(worm%%)1) GetXY(xpos%%,ypos%%,worm%%(WormTail%%)) PosMarker%%(xpos%%,ypos%%)0 0,(bx%%xpos%%dx%%),(by%%ypos%%dy%%) gogogogogo%%0  SetPosMarker() 1 newx%%(1)(nox%%1)1 newy%%(1)(noy%%1)1 PosMarker%%(newx%%,newy%%)0p PosMarker%%(newx%%,newy%%)(1)91 |5,(bx%%newx%%dx%%dx%%2),(by%%newy%%dy%%dy%%2),dx%%,dy%%,(PosMarker%%(newx%%,newy%%),"")  NewGame() te bx%%bordw%% by%%bordw%% bw%%maxx%%bordw%%2 bh%%maxy%%bordw%%2 dx%%square%% dy%%square%% nox%%bw%%dx%% noy%%bh%%dy%% Worm%%,PosMarker%% Worm%%(nox%%noy%%),PosMarker%%(nox%%,noy%%) "Worm" bordfg%%,2bordbg%%0,16,1,8,3,0,0S0,0,0 |1,0,0,maxx%%,bordw%% |1,0,0,bordw%%,maxy%% |1,0,maxy%%bordw%%,maxx%%,bordw%% |1,maxx%%bordw%%,0,bordw%%,maxy%% o"Arial,"(bordw%%2,"") 18 |7,bordw%%,2,50,bordw%%6,WormLen%%,0,"","" |7,(bx%%bw%%50)2,2,50,bordw%%6,MaxLen%%,0,"","" |7,bx%%bw%%50,2,50,bordw%%6,Speed%%,0,"","" 0,0,0,0,0 o"Arial,"(square%%2,"") gogogogogo%%1 Worm%%(0)nox%%(noy%%1)2 WormHead%%0 WormTail%%0 WormTailTogo%%3 WormLen%%0 i%%1qnos%% SetPosMarker() speed%%0 SetSpeed(defspeed%%) MoveWorm(0) t  Setup() wsiz$(20) i%%0q20 wsiz$(i%%)(i%%26,"") speed$(9) i%%0q9 speed$(i%%)(i%%1,"") square$(square%%,"") bordw$(bordw%%,"") speed$(defspeed%%,"") nos$(nos%%,"") headcolo$colours$(headcolo%%) tailcolo$colours$(tailcolo%%) bordfg$colours$(bordfg%%) bordbg$colours$(bordbg%%) cr$(13)(10) instructions$"Welcome to WORM"cr$"================"cr$cr$ instructions$instructions$"The aim of the game is to build up as long a tail as possible by eating numbers, while not bumping into the wall or your own tail."cr$cr$ instructions$instructions$"You can control the worm using cursor keys - to head upwards etc. You cannot directly double back on yourself (at higher speeds, turning round takes good timing)"cr$cr$ instructions$instructions$" to pause, to enter setup dialog, to end!! and for Oh no! the boss is coming!!!" "Instructions",0,0,180,152,"Worm Instructions","MS Sans Serif",8 |"Instructions",1,65,135,50,13,1,"&OK",1,1 |"Instructions",6,2,2,176,130,20484641,0,instructions$,3900 "Colours",0,0,160,86,"Colours","MS Sans Serif",8 |"Colours",5,04,05,80,8,0,"Worm head colour:" |"Colours",8,84,03,70,60,3,2,headcolo$,colours$ |"Colours",5,04,21,80,8,0,"Worm tail colour:" |"Colours",8,84,19,70,60,3,2,tailcolo$,colours$ |"Colours",5,04,37,80,8,0,"Border foreground:" |"Colours",8,84,35,70,60,3,2,bordfg$,colours$ |"Colours",5,04,53,80,8,0,"Border background:" |"Colours",8,84,51,70,60,3,2,bordbg$,colours$ |"Colours",1,022,69,52,14,1,"&OK",1,1 |"Colours",1,084,69,52,14,0,"&Cancel",0,0 "WormSetup",0,0,184,066,"Worm Parameters","MS Sans Serif",8 |"WormSetup",5,04,05,80,8,0,"Worm element size:" |"WormSetup",8,84,03,32,60,3,2,square$,wsiz$ |"WormSetup",5,04,21,80,8,0,"Border size:" |"WormSetup",8,84,19,32,60,3,2,bordw$,wsiz$ |"WormSetup",5,04,37,80,8,0,"Start speed:" |"WormSetup",8,84,35,32,60,3,2,speed$,speed$ |"WormSetup",5,04,53,80,8,0,"Numbers:" |"WormSetup",8,84,51,32,60,3,2,nos$,speed$ |"WormSetup",1,126,02,52,14,0,"&Instructions...",0,2,"Instructions" |"WormSetup",1,126,18,52,14,0,"&Colours...",0,2,"Colours" |"WormSetup",1,126,34,52,14,1,"&OK",1,1 |"WormSetup",1,126,50,52,14,0,"&Cancel",0,0 "WormSetup",isok%% "WormSetup" "Colours" "Instructions" isok%%p square%%0(square$) bordw%%0(bordw$) defspeed%%0(speed$) nos%%0(nos$) headcolo%%0(headcolo$) tailcolo%%0(tailcolo$) bordfg%%0(bordfg$) bordbg%%0(bordbg$)