-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrattler.bas
1550 lines (1412 loc) · 50.7 KB
/
rattler.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'*****************************************************************************
'
'--------------------------- R A T T L E R . B A S ---------------------------
'
'---------------- Copyright (C) 2003 by Bob Seguin (Freeware) ----------------
'
'------------------------ Email: [email protected] -------------------------
'
'--------------------- RATTLER is a graphical version of ---------------------
'--------------------- the classic QBasic game, NIBBLES ----------------------
'
'*****************************************************************************
$Resize:Smooth
DefInt A-Z
Dim Shared SnakePIT(1 To 32, 1 To 24)
Dim Shared WipeBOX(29, 21)
ReDim Shared SpriteBOX(8000)
ReDim Shared NumBOX(400)
ReDim Shared TTBox(480)
ReDim Shared BigBOX(32000)
'The following constants are used to determine sprite array indexes
Const Head = 0
Const Neck = 500
Const Shoulders = 1000
Const Body = 1500
Const Tail = 2000
Const TailEND = 2500
Const Rattle = 3000
Const Mouse = 6000
Const Frog = 6500
Const Stone = 7000
Const Blank = 7500
Const TURN = 3000
Const Left = 0
Const Up = 125
Const Right = 250
Const Down = 375
Const DL = 0
Const DR = 125
Const UR = 250
Const UL = 375
Const RD = 375
Const LD = 250
Const LU = 125
Const RU = 0
Type DiamondBACK
Row As Integer
Col As Integer
BodyPART As Integer
TURN As Integer
WhichWAY As Integer
RattleDIR As Integer
End Type
Dim Shared Rattler(72) As DiamondBACK
Type ScoreTYPE
PlayerNAME As String * 20
PlayDATE As String * 10
PlayerSCORE As Long
End Type
Dim Shared ScoreDATA(10) As ScoreTYPE
Dim Shared SnakeLENGTH
Dim Shared SetSPEED
Dim Shared Speed
Dim Shared SpeedLEVEL
Dim Shared Level
Dim Shared Lives
Dim Shared Score
Dim Shared CrittersLEFT
Open "rattler.top" For Append As #1
Close #1
Open "rattler.top" For Input As #1
Do While Not EOF(1)
Input #1, ScoreDATA(n).PlayerNAME
Input #1, ScoreDATA(n).PlayDATE
Input #1, ScoreDATA(n).PlayerSCORE
n = n + 1
Loop
Close #1
Randomize Timer
Screen 12
_FullScreen _SquarePixels , _Smooth
GoSub DrawSPRITES
DrawSCREEN
Intro
Do
PlayGAME
Loop
End
'------------------------- SUBROUTINE SECTION BEGINS -------------------------
DrawSPRITES:
'Creates images from compressed data
'Set all attributes to black (REM out to view the process)
For n = 1 To 15
Out &H3C8, n
Out &H3C9, 0
Out &H3C9, 0
Out &H3C9, 0
Next n
Out &H3C8, 9
Out &H3C9, 52
Out &H3C9, 42
Out &H3C9, 32
Locate 12, 32: Color 9
Print "ONE MOMENT PLEASE..."
MaxWIDTH = 19
MaxDEPTH = 279
x = 0: y = 0
Do
Read Count, Colr
For Reps = 1 To Count
PSet (x, y), Colr
x = x + 1
If x > MaxWIDTH Then
x = 0
y = y + 1
End If
Next Reps
Loop Until y > MaxDEPTH
'Create directional sets
Index = 0
For y = 0 To 260 Step 20
Get (0, y)-(19, y + 19), SpriteBOX(Index)
GoSub Poses
Index = Index + 500
Next y
Cls
Palette 9, 0
'Create stone block and erasing sprite(s)
Line (0, 0)-(19, 19), 6, BF
For Reps = 1 To 240
x = Fix(Rnd * 20) + 1
y = Fix(Rnd * 20) + 1
PSet (x, y), 7
PSet (x + 1, y + 1), 15
Next Reps
Line (0, 0)-(19, 19), 6, B
Line (1, 1)-(18, 18), 13, B
Line (1, 1)-(1, 18), 15
Line (1, 1)-(18, 1), 15
Get (0, 0)-(19, 19), SpriteBOX(Stone) 'stone tile
Line (0, 0)-(19, 19), 8, BF
Get (0, 0)-(19, 19), SpriteBOX(Blank + Left) 'erasing tile
Get (0, 0)-(19, 19), SpriteBOX(Blank + Up) 'erasing tile
Get (0, 0)-(19, 19), SpriteBOX(Blank + Right) 'erasing tile
Get (0, 0)-(19, 19), SpriteBOX(Blank + Down) 'erasing tile
Cls
Color 9
Locate 9, 31
Print "RATTLER TOP-TEN LIST"
Get (240, 130)-(398, 140), TTBox()
Locate 9, 31
Print Space$(20)
'GET numbers
For n = 0 To 9
Locate 10, 10
If n = 0 Then Print "O" Else Print LTrim$(Str$(n))
For x = 72 To 80
For y = 144 To 160
If Point(x, y) = 0 Then PSet (x, y), 15 Else PSet (x, y), 4
Next y
Next x
Get (72, 144)-(79, 156), NumBOX(NumDEX)
NumDEX = NumDEX + 40
Next n
Line (72, 144)-(80, 160), 0, BF
Return
Poses:
'Draws/GETs the other 3 directional poses from each sprite
For i = Index To Index + 250 Step 125
Put (100, 100), SpriteBOX(i), PSet
For Px = 100 To 119
For Py = 100 To 119
PSet (219 - Py, Px - 20), Point(Px, Py)
Next Py
Next Px
Get (100, 80)-(119, 99), SpriteBOX(i + 125)
Next i
Return
SpriteVALUES:
Data 47,8,2,12,2,0,16,8,3,5,1,12,1,13,1,12,1,13,1,12,8,8,1,0
Data 1,12,1,15,1,8,1,15,3,5,1,14,3,1,1,14,1,13,5,8,2,5,1,12
Data 1,5,4,12,3,3,1,5,1,12,1,3,1,12,1,14,1,13,2,8,1,3,14,5
Data 1,3,1,5,1,1,1,13,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 1,12,1,5,1,12,3,5,1,12,1,5,1,12,2,3,1,1,22,5,1,12,1,5
Data 1,12,1,3,1,12,1,3,1,12,1,3,1,12,1,3,1,12,1,15,1,12,1,3
Data 1,12,1,3,1,12,1,3,2,5,1,12,1,5,1,12,1,3,1,12,1,3,1,12
Data 1,3,1,12,1,3,1,12,1,15,1,12,1,3,1,12,1,3,1,12,1,3,17,5
Data 1,3,2,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 1,12,3,5,1,12,1,5,1,12,2,3,1,1,1,8,1,3,14,5,1,3,1,14
Data 1,1,1,13,2,8,2,5,1,12,1,5,4,12,2,3,1,1,1,5,1,12,1,1
Data 1,12,1,14,1,13,4,8,1,0,1,12,1,15,1,8,1,15,3,5,2,14,2,1
Data 1,14,1,13,10,8,2,5,1,14,1,12,1,13,1,12,1,13,1,12,12,8,2,12
Data 2,0,169,8,1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,1,1,13,1,12
Data 1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,1,1,13,1,12,1,1,1,14
Data 1,1,1,14,1,12,1,14,1,12,1,14,1,1,1,14,1,1,1,14,1,1,1,14
Data 1,12,1,14,1,12,1,14,1,1,1,14,2,3,1,5,1,12,1,5,1,12,1,5
Data 1,12,1,5,3,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5,3,3,1,12
Data 1,5,1,12,1,5,1,12,1,5,1,12,1,5,2,3,1,12,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 1,12,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 2,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5,3,3,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,3,1,1,1,14,1,1,1,14,1,12,1,14,1,12
Data 1,14,1,1,1,14,1,1,1,14,1,1,1,14,1,12,1,14,1,12,1,14,1,1
Data 1,14,1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,1,1,13,1,12,1,13
Data 1,12,1,13,1,1,1,13,1,12,1,13,1,1,1,13,1,12,220,8,1,12,1,13
Data 1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13
Data 1,12,1,13,1,12,1,13,1,12,1,13,1,14,1,12,1,14,1,1,1,14,1,12
Data 1,14,1,1,1,14,1,12,1,14,1,12,1,14,1,1,1,14,1,12,1,14,1,1
Data 1,14,2,12,1,14,1,3,1,14,1,12,1,14,1,12,1,14,1,3,1,14,1,12
Data 1,14,1,3,1,14,1,12,1,14,1,12,1,14,1,3,1,14,1,5,1,3,1,5
Data 1,12,1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,3,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,3,1,15,1,5,1,12,1,5,1,12,1,5,1,12
Data 1,5,1,12,1,5,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12
Data 1,5,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,15
Data 1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,2,5,1,3,1,5,1,12
Data 1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,3,1,5,1,12,1,5,1,12
Data 1,5,1,12,1,5,1,3,1,12,1,14,1,3,1,14,1,12,1,14,1,12,1,14
Data 1,3,1,14,1,12,1,14,1,3,1,14,1,12,1,14,1,12,1,14,1,3,2,14
Data 1,12,1,14,1,1,1,14,1,12,1,14,1,1,1,14,1,12,1,14,1,12,1,14
Data 1,1,1,14,1,12,1,14,1,1,1,14,2,12,1,13,1,12,1,13,1,12,1,13
Data 1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13,1,12,1,13
Data 1,12,1,13,180,8,1,13,1,12,1,13,1,12,1,13,1,1,1,13,1,12,1,13
Data 1,12,1,13,1,12,1,13,1,12,1,13,1,1,1,13,1,12,1,13,2,12,1,14
Data 1,12,1,14,1,1,1,5,1,1,1,14,1,12,1,14,1,12,1,14,1,12,1,14
Data 1,1,1,5,1,1,1,14,1,12,2,14,1,12,1,14,1,1,1,14,1,12,1,14
Data 1,1,1,14,1,12,1,14,1,12,1,14,1,1,1,14,1,12,1,14,1,1,1,14
Data 2,12,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,12,1,5
Data 1,3,1,5,1,12,1,5,1,12,1,5,1,3,2,5,1,3,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,3,1,5,1,3,1,5,1,12,1,5,1,12,1,5
Data 1,12,1,5,1,3,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12
Data 1,5,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,15
Data 1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,15,1,5,1,12
Data 1,5,1,12,1,5,1,12,1,5,1,12,2,5,1,3,1,5,1,12,1,5,1,12
Data 1,5,1,12,1,5,1,3,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12
Data 1,5,1,3,1,12,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,3,1,5
Data 1,12,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,14,1,12
Data 1,14,1,1,1,14,1,12,1,14,1,1,1,14,1,12,1,14,1,12,1,14,1,1
Data 1,14,1,12,1,14,1,1,1,14,2,12,1,14,1,12,1,14,1,1,1,14,1,1
Data 1,14,1,12,1,14,1,12,1,14,1,12,1,14,1,1,1,14,1,1,1,14,1,12
Data 1,14,1,13,1,12,1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,12,1,13
Data 1,12,1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,12,220,8,1,12,1,13
Data 1,1,1,13,1,12,1,13,1,12,1,13,1,1,1,13,1,12,1,13,1,1,1,13
Data 1,12,1,13,1,12,1,13,1,1,1,13,1,14,1,1,1,14,1,12,1,14,1,12
Data 1,14,1,12,1,14,1,1,1,14,1,1,1,14,1,12,1,14,1,12,1,14,1,12
Data 1,14,1,1,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,15,1,5
Data 1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,15,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,12,1,5,1,14,1,1,1,14,1,12,1,14,1,12
Data 1,14,1,12,1,14,1,3,1,14,1,3,1,14,1,12,1,14,1,12,1,14,1,12
Data 1,14,1,1,1,12,1,13,1,1,1,13,1,12,1,13,1,12,1,13,1,1,1,13
Data 1,12,1,13,1,1,1,13,1,12,1,13,1,12,1,13,1,1,1,13,300,8,1,12
Data 1,13,1,12,1,13,1,3,1,13,1,3,1,13,1,3,1,13,1,12,1,13,1,12
Data 1,13,1,3,1,13,1,3,1,13,1,3,1,13,1,5,1,12,1,5,1,12,1,5
Data 1,3,1,5,1,12,2,3,1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,12
Data 2,3,1,5,1,12,1,5,1,12,1,5,1,3,1,5,1,12,2,3,1,5,1,12
Data 1,5,1,12,1,5,1,3,1,5,1,12,2,3,1,12,1,13,1,12,1,13,1,3
Data 1,13,1,3,1,13,1,3,1,13,1,12,1,13,1,12,1,13,1,3,1,13,1,3
Data 1,13,1,3,1,13,286,8,2,13,1,8,2,13,1,8,2,13,1,8,2,13,8,8
Data 1,5,2,1,1,14,2,1,1,14,2,1,1,14,2,1,1,14,1,13,1,8,1,13
Data 1,3,1,13,1,3,1,13,1,1,2,3,1,14,2,3,1,14,2,3,1,14,2,3
Data 1,14,1,3,1,13,1,3,1,5,1,12,5,3,1,5,2,3,1,5,2,3,1,5
Data 2,3,1,5,3,3,1,5,1,12,5,3,1,5,2,3,1,5,2,3,1,5,2,3
Data 1,5,2,3,1,13,1,3,1,13,1,3,1,13,1,1,2,3,1,14,2,3,1,14
Data 2,3,1,14,2,3,1,14,1,3,1,13,5,8,1,5,2,1,1,12,2,1,1,12
Data 2,1,1,12,2,1,1,14,1,13,7,8,2,13,1,8,2,13,1,8,2,13,1,8
Data 2,13,129,8,1,12,1,5,1,3,2,5,1,3,1,5,1,12,12,8,1,13,1,1
Data 1,5,2,12,1,5,1,1,1,13,12,8,1,12,1,5,1,12,2,5,1,12,1,5
Data 1,12,12,8,1,13,1,12,1,5,2,12,1,5,1,12,1,13,12,8,1,12,1,5
Data 1,12,2,5,1,12,1,5,1,12,11,8,1,13,1,5,1,3,1,5,2,12,1,5
Data 1,1,1,13,6,8,1,13,1,12,1,13,1,12,1,13,1,1,1,5,1,15,1,12
Data 2,5,1,3,1,5,1,12,6,8,1,1,1,5,1,1,1,5,1,12,1,5,1,12
Data 1,5,1,15,1,5,1,3,1,5,1,1,1,13,6,8,2,3,1,5,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,3,2,5,1,13,7,8,1,12,1,15,1,12,1,5
Data 1,12,1,5,1,12,1,5,1,12,2,5,1,1,1,12,7,8,1,5,1,15,1,12
Data 1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,1,1,13,8,8,2,3,1,5
Data 1,12,1,5,1,12,1,5,1,12,1,5,1,3,1,12,9,8,1,1,1,5,1,1
Data 1,5,1,12,1,5,1,12,1,5,1,1,1,13,10,8,1,13,1,12,1,13,1,12
Data 1,13,1,12,1,13,1,12,137,8,1,13,1,12,1,14,1,3,2,5,1,3,1,14
Data 1,12,1,13,10,8,1,12,1,14,1,3,1,5,2,12,1,5,1,3,1,14,1,12
Data 10,8,1,13,1,1,1,5,1,12,2,5,1,12,1,5,1,1,1,13,10,8,1,12
Data 1,3,1,12,1,5,2,12,1,5,1,12,1,5,1,12,9,8,1,13,1,14,1,3
Data 2,12,2,5,1,12,1,5,1,14,1,13,5,8,1,12,1,13,1,12,1,13,1,12
Data 1,5,1,3,1,5,1,12,1,5,1,12,2,5,1,1,1,12,5,8,1,14,1,12
Data 1,14,1,1,1,3,1,12,1,5,1,15,1,5,1,12,1,5,1,12,1,3,1,14
Data 1,13,5,8,1,12,1,14,1,1,1,5,1,12,2,3,1,5,1,15,2,5,1,3
Data 1,14,1,13,6,8,1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 2,3,1,14,2,12,6,8,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5
Data 1,3,1,12,1,14,1,12,1,13,7,8,1,15,1,5,1,12,1,5,1,12,1,5
Data 1,12,1,5,1,3,1,14,1,12,1,13,1,12,7,8,1,5,1,3,1,5,1,12
Data 1,5,1,12,1,5,1,12,2,1,1,13,1,12,8,8,1,12,1,14,1,1,1,14
Data 1,12,1,14,1,12,1,14,1,1,1,13,1,12,9,8,1,14,1,12,1,14,1,1
Data 1,14,1,12,1,14,1,13,1,12,11,8,1,12,1,13,1,12,1,13,1,12,1,13
Data 1,12,117,8,1,13,1,12,1,5,1,3,1,5,2,12,1,5,1,3,1,14,1,12
Data 1,13,8,8,1,12,1,14,1,3,1,5,1,12,2,5,1,12,1,5,1,3,1,14
Data 1,12,8,8,1,13,2,3,1,12,1,5,2,12,1,5,1,12,1,5,1,3,1,13
Data 7,8,1,13,1,14,1,3,1,12,1,5,1,12,2,5,1,12,1,5,1,12,1,5
Data 1,3,4,8,1,12,1,13,1,12,1,14,1,12,2,3,1,12,1,5,2,12,1,5
Data 1,12,1,14,1,3,1,13,4,8,1,14,1,12,3,3,1,12,1,3,1,5,1,12
Data 2,5,1,12,1,5,1,3,1,14,1,12,4,8,1,12,1,5,1,3,1,14,1,12
Data 4,3,2,12,1,5,1,3,1,5,1,12,1,13,4,8,1,14,1,3,1,5,1,12
Data 1,5,1,12,1,5,1,12,4,3,1,5,1,12,1,14,1,12,4,8,2,3,1,12
Data 1,5,1,12,1,5,1,12,1,5,1,12,1,3,3,12,1,14,1,12,5,8,1,5
Data 1,3,1,5,1,12,1,5,2,12,2,5,1,3,1,12,2,14,1,12,1,13,5,8
Data 1,5,1,3,1,5,1,12,1,5,1,12,1,5,1,12,1,14,1,3,1,14,2,12
Data 1,14,6,8,1,3,1,5,1,3,1,5,1,12,1,5,1,12,1,14,1,12,1,3
Data 1,12,2,14,1,12,6,8,1,5,1,12,1,5,1,3,1,14,1,12,1,14,1,12
Data 1,14,1,3,1,14,1,12,1,13,7,8,1,12,1,14,1,12,1,5,3,3,1,5
Data 1,3,1,5,1,12,1,13,8,8,1,14,1,12,1,14,1,12,1,14,1,12,1,14
Data 1,12,1,13,1,12,1,0,9,8,1,12,1,13,1,12,1,13,1,12,1,13,1,12
Data 1,13,1,0,98,8,1,13,1,3,2,5,1,3,1,13,14,8,1,3,1,14,2,12
Data 1,5,1,3,14,8,1,13,1,12,2,5,1,12,1,13,14,8,1,12,1,14,2,12
Data 1,14,1,12,14,8,1,13,1,12,2,5,1,12,1,13,14,8,1,3,1,14,2,12
Data 1,14,1,3,13,8,1,13,1,14,1,12,2,5,1,12,1,5,7,8,1,12,1,13
Data 1,3,1,13,1,12,1,3,1,12,1,15,1,12,1,5,1,12,1,3,1,13,7,8
Data 1,14,1,3,1,14,1,12,1,14,1,12,1,3,1,12,1,15,1,12,1,3,1,5
Data 8,8,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12,1,5,1,12
Data 1,13,8,8,1,15,1,5,1,12,1,5,1,12,1,5,1,12,1,3,1,12,1,14
Data 1,13,9,8,1,14,1,3,1,14,1,12,1,14,1,12,1,14,1,12,1,13,1,3
Data 10,8,1,12,1,13,1,3,1,13,1,12,1,3,1,12,1,13,160,8,1,1,2,3
Data 1,1,16,8,1,1,2,3,1,1,16,8,1,13,2,12,1,13,16,8,1,3,2,5
Data 1,3,16,8,1,13,2,3,1,13,16,8,1,3,2,5,1,3,15,8,1,13,1,5
Data 1,15,1,12,1,13,14,8,1,13,1,5,1,12,2,5,1,0,8,8,1,12,1,13
Data 1,12,1,13,1,3,1,13,3,3,2,12,9,8,1,3,1,12,1,3,1,12,1,3
Data 1,15,1,5,1,12,2,3,1,0,9,8,1,5,1,12,1,5,1,12,1,5,1,15
Data 1,5,1,12,1,3,11,8,1,12,1,13,1,12,1,13,1,3,1,13,1,3,1,0
Data 257,8,2,6,3,8,2,6,1,7,7,8,1,13,1,8,1,13,1,8,3,6,1,7
Data 3,8,2,7,1,13,7,8,1,6,2,8,2,6,2,7,1,8,1,0,3,6,1,7
Data 8,8,2,7,1,15,2,7,1,8,1,0,5,6,1,7,6,8,2,7,1,8,1,15
Data 2,6,1,7,7,6,1,7,4,8,1,6,4,7,2,6,1,7,7,6,1,7,2,6
Data 2,8,1,6,4,7,2,6,1,7,7,6,1,7,1,6,1,8,1,6,2,8,2,7
Data 1,8,1,15,2,6,1,7,7,6,1,7,3,8,1,6,2,8,2,7,1,15,2,7
Data 1,8,1,0,5,6,1,7,4,8,1,6,1,8,1,6,2,8,2,6,2,7,1,8
Data 1,0,3,6,1,7,4,8,1,6,1,8,1,13,1,8,1,13,1,8,3,6,1,7
Data 3,8,2,7,1,13,3,8,1,13,7,8,2,6,3,8,2,6,1,7,5,8,1,13
Data 138,8,1,10,8,8,1,10,7,8,1,2,1,8,1,10,8,8,1,10,2,2,5,8
Data 2,11,1,2,1,8,1,2,10,8,1,2,2,8,1,10,2,2,1,8,1,2,9,8
Data 1,10,1,2,1,8,1,2,1,8,4,2,10,8,1,10,1,15,2,2,1,11,2,2
Data 2,11,2,2,8,8,1,10,1,8,1,15,1,2,2,11,2,2,2,11,3,2,6,8
Data 1,10,6,2,1,11,3,2,1,11,2,2,6,8,1,10,6,2,1,11,3,2,1,11
Data 2,2,7,8,1,10,1,8,1,15,1,2,2,11,2,2,2,11,3,2,8,8,1,10
Data 1,15,2,2,1,11,2,2,2,11,2,2,10,8,1,10,1,2,1,8,1,2,1,8
Data 4,2,14,8,1,2,2,8,1,10,2,2,1,8,1,2,9,8,1,10,2,2,5,8,2
Data 11,1,2,1,8,1,2,8,8,1,10,7,8,1,2,1,8,1,10,20,8,1,10,42,8
PaletteVALUES:
Data 18,18,18,50,44,36,0,42,0,56,50,42
Data 63,0,0,51,43,30,48,48,52,42,42,42
Data 0,14,0,54,24,63,21,63,21,0,30,0
Data 34,22,21,32,32,32,45,37,24,63,63,63
Sub DrawSCREEN
For Col = 1 To 32
PutSPRITE Col, 1, Stone
PutSPRITE Col, 24, Stone
Next Col
For Row = 1 To 24
PutSPRITE 1, Row, Stone
PutSPRITE 32, Row, Stone
Next Row
Color 4
Locate 3, 5: Print "LIVES:"
Locate 3, 34: Print "R A T T L E R"
Locate 3, 65: Print "SCORE:"
For x = 254 To 376
For y = 32 To 45
PSet (x + 4, y - 30), 15
Next y
Next x
For x = 254 To 376
For y = 32 To 45
If Point(x, y) = 4 Then
PSet (x + 6, y - 29), 0
PSet (x + 5, y - 30), 5
End If
PSet (x, y), 0
Next y
Next x
Line (258, 1)-(378, 1), 0
Line (258, 1)-(258, 15), 0
For x = 26 To 99
For y = 32 To 45
PSet (x + 4, y - 30), 15
Next y
Next x
For x = 26 To 99
For y = 32 To 45
If Point(x, y) = 4 Then PSet (x + 6, y - 30), 0
PSet (x, y), 0
Next y
Next x
Line (28, 1)-(103, 1), 0
Line (28, 1)-(28, 15), 0
For x = 504 To 607
For y = 32 To 45
If Point(x, y) = 4 Then
PSet (x + 4, y - 30), 0
Else
PSet (x + 4, y - 30), 15
End If
PSet (x, y), 0
Next y
Next x
Line (508, 1)-(611, 1), 0
Line (508, 1)-(508, 15), 0
Locate 28, 5: Print "LEVEL:"
For x = 28 To 98
For y = 432 To 445
If Point(x, y) = 4 Then
PSet (x, y + 32), 0
Else
PSet (x, y + 32), 15
End If
PSet (x, y), 0
Next y
Next x
Line (28, 463)-(98, 463), 0
Line (28, 463)-(28, 476), 0
Locate 28, 70: Print "SPEED:"
For x = 548 To 612
For y = 432 To 445
If Point(x, y) = 4 Then
PSet (x, y + 32), 0
Else
PSet (x, y + 32), 15
End If
PSet (x, y), 0
Next y
Next x
Line (548, 463)-(612, 463), 0
Line (548, 463)-(548, 476), 0
Line (267, 463)-(371, 476), 15, BF
Line (267, 463)-(371, 463), 0
Line (267, 463)-(267, 476), 0
Line (20, 20)-(619, 459), 8, BF
End Sub
Function EndGAME
If Lives = 0 Then
RemainingLIVES& = 1
Else
RemainingLIVES& = Lives
End If
FinalSCORE& = Score * RemainingLIVES& * 10&
Get (166, 152)-(472, 327), BigBOX()
Line (166, 152)-(472, 327), 0, BF
Line (168, 154)-(470, 325), 8, B
Line (170, 156)-(468, 323), 7, B
Line (172, 158)-(466, 321), 6, B
If FinalSCORE& > ScoreDATA(9).PlayerSCORE Then
Color 4
Locate 12, 31
Print "- G A M E O V E R -"
Color 3
If Lives = 0 Then
Locate 13, 30
Print "(Sorry, no more lives)"
Else
Locate 13, 33
Print "Congratulations!"
End If
Hundred$ = LTrim$(Str$(FinalSCORE& Mod 1000))
If FinalSCORE& >= 1000 Then
If Val(Hundred$) = 0 Then Hundred$ = "000"
If Val(Hundred$) < 100 Then Hundred$ = "0" + Hundred$
Thousand$ = LTrim$(Str$(FinalSCORE& \ 1000))
FinalSCORE$ = Thousand$ + "," + Hundred$
Else
FinalSCORE$ = Hundred$
End If
Color 6: Locate 15, 28: Print "Your final score is ";
Color 15: Print FinalSCORE$
Color 9
Locate 16, 26: Print "Enter your name to record score"
Locate 17, 26: Print "(Just press ENTER to decline):"
Color 15
Locate 19, 26: Input ; Name$
If Len(Name$) Then
ScoreDATA(10).PlayerNAME = Left$(Name$, 20)
ScoreDATA(10).PlayDATE = Date$
ScoreDATA(10).PlayerSCORE = FinalSCORE&
For a = 0 To 10
For B = a To 10
If ScoreDATA(B).PlayerSCORE > ScoreDATA(a).PlayerSCORE Then
Swap ScoreDATA(B), ScoreDATA(a)
End If
Next B
Next a
TopTEN
Open "rattler.top" For Output As #1
For Reps = 0 To 9
Write #1, ScoreDATA(Reps).PlayerNAME
Write #1, ScoreDATA(Reps).PlayDATE
Write #1, ScoreDATA(Reps).PlayerSCORE
Next Reps
Close #1
End If
End If
Line (176, 160)-(462, 317), 0, BF
Color 4: Locate 14, 31: Print "- G A M E O V E R -"
Color 9
Locate 16, 26: Print "Start new game......"
Locate 17, 26: Print "QUIT................"
Color 6
Locate 16, 47: Print "Press [1]"
Locate 17, 47: Print "Press [2]"
Do
k$ = InKey$
Loop Until k$ = "1" Or k$ = "2" Or k$ = Chr$(27)
If k$ = "1" Then EndGAME = 1: Exit Function
Palette: Color 7: Cls
System
End Function
Sub InitGAME
SetSPEED = 9
SpeedLEVEL = 3
Level = 1
Lives = 5
Score = 0
CrittersLEFT = 10
End Sub
Sub InitLEVEL
Erase SnakePIT
SnakeLENGTH = 11
StartCOL = 22
For n = 1 To SnakeLENGTH
StartCOL = StartCOL - 1
Rattler(n).Col = StartCOL
Rattler(n).Row = 22
Rattler(n).TURN = 0
Rattler(n).WhichWAY = Right
Select Case n
Case 1: Rattler(n).BodyPART = Head
Case 2: Rattler(n).BodyPART = Neck
Case 3: Rattler(n).BodyPART = Shoulders
Case 4: Rattler(n).BodyPART = Body
Case 5: Rattler(n).BodyPART = Body
Case 6: Rattler(n).BodyPART = Shoulders
Case 7: Rattler(n).BodyPART = Neck
Case 8: Rattler(n).BodyPART = Tail
Case 9: Rattler(n).BodyPART = TailEND
Case 10: Rattler(n).BodyPART = Rattle
Case 11: Rattler(n).BodyPART = Blank
End Select
Next n
PrintNUMS 1, Lives
PrintNUMS 2, Score
PrintNUMS 3, Level
PrintNUMS 5, SpeedLEVEL
For n = 1 To SnakeLENGTH
RCol = Rattler(n).Col
RRow = Rattler(n).Row
RIndex = Rattler(n).BodyPART + Rattler(n).TURN + Rattler(n).WhichWAY
PutSPRITE RCol, RRow, RIndex
Next n
SnakePIT(Rattler(SnakeLENGTH).Col, Rattler(SnakeLENGTH).Row) = 0
For Col = 1 To 32
SnakePIT(Col, 1) = -1
SnakePIT(Col, 24) = -1
Next Col
For Row = 2 To 23
SnakePIT(1, Row) = -1
SnakePIT(32, Row) = -1
Next Row
Line (271, 466)-(368, 474), 15, BF
For x = 271 To 361 Step 10
Count = Count + 1
If Count Mod 2 Then Colr = 11 Else Colr = 7
Line (x, 466)-(x + 7, 474), Colr, BF
Next x
End Sub
Sub Instructions
Get (100, 100)-(539, 379), BigBOX()
Line (100, 100)-(539, 379), 0, BF
Line (106, 106)-(533, 373), 13, B
Line (108, 108)-(531, 371), 7, B
Line (110, 110)-(529, 369), 6, B
Color 9: Locate 10, 27: Print "- I N S T R U C T I O N S -"
Color 6
Locate 12, 18: Print "RATTLER is a variation on the classic Microsoft"
Locate 13, 18: Print "QBasic game NIBBLES."
Color 15
Locate 12, 18: Print "RATTLER": Locate 13, 30: Print "NIBBLES"
Color 6
Locate 15, 18: Print "Steer the Diamondback Rattler using the Arrow"
Locate 16, 18: Print "keys, eating mice and frogs and scoring points"
Color 15: Locate 15, 58: Print "Arrow": Color 6
Locate 17, 18: Print "for each kill. These wary creatures cannot be"
Locate 18, 18: Print "caught from the front or sides, however. They"
Locate 19, 18: Print "must be snuck up on from behind, otherwise"
Locate 20, 18: Print "they will simply jump to a new location."
Color 13: Locate 22, 28: Print "PRESS ANY KEY TO CONTINUE..."
a$ = Input$(1)
Line (120, 160)-(519, 332), 0, BF
Color 6
Locate 12, 18: Print "With each creature eaten, the rattler grows"
Locate 13, 18: Print "in length, making steering much more difficult"
Locate 14, 18: Print "and increasing the chance of self-collision."
Locate 16, 18: Print "There are ten levels, each one more hazardous"
Locate 17, 18: Print "than the last. If the snake hits a stone wall"
Locate 18, 18: Print "or bumps into himself, he dies. He has a total"
Locate 19, 18: Print "of five lives. Once they are used up, the game"
Locate 20, 18: Print "is over."
Color 15
Locate 16, 28: Print "ten": Locate 19, 21: Print "five"
a$ = Input$(1)
Line (120, 160)-(519, 332), 0, BF
Color 6
Locate 12, 18: Print "Often, a mouse or frog will have its back to"
Locate 13, 18: Print "a wall, making it impossible to kill. In those"
Locate 14, 18: Print "situations, you must attack from the front or"
Locate 15, 18: Print "sides, forcing it to move to a location where"
Locate 16, 18: Print "its back is exposed."
Locate 18, 18: Print "There are five speeds to choose from. It may"
Locate 19, 18: Print "be wise to choose a slower speed for the high-"
Locate 20, 18: Print "er levels. The default speed is 3."
Color 15: Locate 18, 28: Print "five": Locate 20, 50: Print "3"
a$ = Input$(1)
Line (120, 160)-(519, 332), 0, BF
Color 9
Locate 12, 18: Print "SCORING:"
Color 6
Locate 12, 18: Print "SCORING: Each kill scores 10 points multiplied"
Locate 13, 18: Print "by the level of difficulty and the speed. For"
Locate 14, 18: Print "example, at level 5, speed 3, a kill is worth"
Locate 15, 18: Print "150 points; level 10, speed 2: 200 points."
Locate 17, 18: Print "If you manage to complete all 10 levels, your"
Locate 18, 18: Print "final score is then multiplied by the number"
Locate 19, 18: Print "of remaining lives. In other words, the score"
Locate 20, 18: Print "accurately reflects your level of achievement."
Color 15
Locate 12, 18: Print "SCORING"
Locate 12, 44: Print "10": Locate 14, 36: Print "5"
Locate 14, 45: Print "3": Locate 15, 18: Print "150"
Locate 15, 36: Print "10": Locate 15, 46: Print "2"
Locate 15, 49: Print "200"
a$ = Input$(1)
Line (120, 160)-(519, 368), 0, BF
Color 6
Locate 12, 18: Print "Indicators of remaining lives and the current"
Locate 13, 18: Print "score are located at the top of the screen on"
Color 15: Locate 12, 42: Print "lives"
Locate 13, 18: Print "score": Color 6
Locate 14, 18: Print "the extreme left and right, respectively."
Locate 16, 18: Print "The current level of play can be found on the"
Locate 17, 18: Print "bottom-left of the screen. Bottom-center you"
Locate 18, 18: Print "will find a graph indicating the number of"
Locate 19, 18: Print "prey remaining on the current level. The cur-"
Locate 20, 18: Print "rent speed can be read bottom-right."
Color 15
Locate 16, 30: Print "level"
Locate 18, 51: Print "number of": Locate 19, 18: Print "prey"
Locate 20, 23: Print "speed"
Color 13: Locate 22, 25: Print "PRESS ANY KEY TO RETURN TO GAME..."
a$ = Input$(1)
Put (100, 100), BigBOX(), PSet
End Sub
Sub Intro
PutSPRITE 7, 16, Rattle + Up
PutSPRITE 7, 15, TailEND + Up
PutSPRITE 7, 14, Tail + Up
PutSPRITE 7, 13, Neck + Up
PutSPRITE 7, 12, Shoulders + Up
PutSPRITE 7, 11, Body + Up
PutSPRITE 7, 10, Body + TURN + UR
PutSPRITE 8, 10, Body + Right
PutSPRITE 9, 10, Body + TURN + RD
PutSPRITE 9, 11, Body + TURN + DL
PutSPRITE 8, 11, Body + TURN + LD
PutSPRITE 8, 12, Body + TURN + DR
PutSPRITE 9, 12, Body + TURN + RD
PutSPRITE 9, 13, Body + Down
PutSPRITE 9, 14, Body + TURN + DR
PutSPRITE 10, 14, Body + TURN + RU
PutSPRITE 10, 13, Body + Up
PutSPRITE 10, 12, Body + Up
PutSPRITE 10, 11, Body + Up
PutSPRITE 10, 10, Body + TURN + UR
PutSPRITE 11, 10, Body + Right
PutSPRITE 12, 10, Body + TURN + RD
PutSPRITE 12, 11, Body + Down
PutSPRITE 12, 12, Body + Down
PutSPRITE 12, 13, Body + Down
PutSPRITE 12, 14, Body + TURN + DR
PutSPRITE 13, 14, Body + Right
PutSPRITE 11, 12, Body + Right
PutSPRITE 13, 10, Body + Right
PutSPRITE 14, 10, Body + Right
PutSPRITE 15, 10, Body + Right
PutSPRITE 16, 10, Body + Right
PutSPRITE 17, 10, Body + Right
PutSPRITE 14, 11, Body + Down
PutSPRITE 14, 12, Body + Down
PutSPRITE 14, 13, Body + Down
PutSPRITE 14, 14, Body + TURN + DR
PutSPRITE 15, 14, Body + Right
PutSPRITE 16, 11, Body + Down
PutSPRITE 16, 12, Body + Down
PutSPRITE 16, 13, Body + Down
PutSPRITE 16, 14, Body + TURN + DR
PutSPRITE 17, 14, Body + Right
PutSPRITE 18, 10, Body + Down
PutSPRITE 18, 11, Body + Down
PutSPRITE 18, 12, Body + Down
PutSPRITE 18, 13, Body + Down
PutSPRITE 18, 14, Body + TURN + DR
PutSPRITE 19, 14, Body + Right
PutSPRITE 20, 10, Body + TURN + UR
PutSPRITE 21, 12, Body + Right
PutSPRITE 21, 10, Body + Right
PutSPRITE 20, 11, Body + Down
PutSPRITE 20, 12, Body + Down
PutSPRITE 20, 13, Body + Down
PutSPRITE 20, 14, Body + TURN + DR
PutSPRITE 21, 14, Body + Right
PutSPRITE 22, 16, Rattle + Up
PutSPRITE 22, 15, TailEND + Up
PutSPRITE 22, 14, Tail + Up
PutSPRITE 22, 13, Neck + Up
PutSPRITE 22, 12, Shoulders + Up
PutSPRITE 22, 11, Body + Up
PutSPRITE 22, 10, Body + TURN + UR
PutSPRITE 23, 10, Body + Right
PutSPRITE 24, 10, Body + TURN + RD
PutSPRITE 24, 11, Body + TURN + DL
PutSPRITE 23, 11, Body + TURN + LD
PutSPRITE 23, 12, Body + TURN + DR
PutSPRITE 24, 12, Body + TURN + RD
PutSPRITE 24, 13, Body + Down
PutSPRITE 24, 14, Body + TURN + DR
PutSPRITE 25, 14, Body + Right
PutSPRITE 26, 14, Shoulders + TURN + RU
PutSPRITE 26, 13, Neck + Up
PutSPRITE 26, 12, Head + Up
Color 13
Locate 22, 20
Print "Copyright (C) 2003 by Bob Seguin (Freeware)"
For x = 152 To 496
For y = 336 To 352
If Point(x, y) = 0 Then PSet (x, y), 8
Next y
Next x
Line (80, 106)-(560, 386), 13, B
Line (76, 102)-(564, 390), 7, B
SetPALETTE
Play "MFMST200L32O0AP16AP16AP16DP16AP16AP16AP16>C<P16A"
For Reps = 1 To 18
GoSub Rattle1
Next Reps
Wipe
Exit Sub
'------------------------ SUBROUTINE SECTION BEGINS --------------------------
Rattle1:
If Reps Mod 3 = 0 Then
Line (509, 215)-(510, 219), 4, B
Line (508, 210)-(508, 214), 4
Line (511, 210)-(511, 214), 4
End If
Hula = Hula + 1
Play "MFT220L64O0C"
Wait &H3DA, 8
Wait &H3DA, 8, 8
Select Case Hula Mod 2
Case 0
Put (418, 300), SpriteBOX(Rattle + Up), PSet
Case 1
Put (422, 300), SpriteBOX(Rattle + Up), PSet
End Select
Sound 30000, 1
Wait &H3DA, 8
Wait &H3DA, 8, 8
Put (420, 300), SpriteBOX(Rattle + Up), PSet
If Reps Mod 3 = 0 Then
Line (508, 210)-(511, 219), 8, BF
End If
Return
End Sub
Sub PauseMENU (Item)
Do
Get (166, 162)-(472, 317), BigBOX()
Line (166, 162)-(472, 317), 0, BF
Line (168, 164)-(470, 315), 8, B
Line (170, 166)-(468, 313), 7, B
Line (172, 168)-(466, 311), 6, B
Select Case Item
Case 1
Color 4: Locate 13, 34: Print "L E V E L -"; (Str$(Level))
Color 15: Locate 15, 30: Print "PRESS SPACE TO BEGIN..."
Color 9: Locate 16, 26: Print "Instructions:[I] SetSPEED:[S]"
Locate 17, 24: Print "EXIT:[Esc] TopTEN:[T] ReSTART:[R]"
Color 7: Locate 19, 25: Print "To pause during play press SPACE"
Case 2
Color 4: Locate 14, 29: Print "- G A M E P A U S E D -"
Color 6: Locate 15, 29: Print "Press SPACE to continue..."
Color 9: Locate 17, 26: Print "Instructions:[I] SetSPEED:[S]"
Locate 18, 24: Print "EXIT:[Esc] TopTEN:[T] ReSTART:[R]"
End Select
Do: Loop Until InKey$ = "" 'Clear INKEY$ buffer
Do
Do
k$ = UCase$(InKey$)
Loop While k$ = ""
Select Case k$
Case "I": GoSub CloseMENU: Instructions: Exit Do
Case "S": GoSub CloseMENU: SpeedSET: Exit Do
Case "R": GoSub CloseMENU: Item = -1: Exit Sub
Case "T": GoSub CloseMENU: TopTEN: Exit Do
Case Chr$(27): System
Case " ": GoSub CloseMENU: Exit Sub
End Select
Loop
Loop
GoSub CloseMENU
Exit Sub
CloseMENU:
Put (166, 162), BigBOX(), PSet
Return
End Sub
Sub PlayGAME
If Level = 0 Then InitGAME
InitLEVEL
SetSTONES Level
Speed = SetSPEED
GoSub PutPREY
Col = 21: Row = 22
RowINC = 0: ColINC = 1
Direction = Right: OldDIRECTION = Right
Increase = 0: Item = 1
Do: Loop Until InKey$ = "" 'Clear INKEY$ buffer
PauseMENU Item
If Item = -1 Then GoSub ReSTART
For Reps = 1 To 6
GoSub Rattle2
Next Reps
Do
k$ = InKey$
Select Case k$
Case Chr$(0) + "H"
If RowINC <> 1 Then RowINC = -1: ColINC = 0: Direction = Up
Case Chr$(0) + "P"
If RowINC <> -1 Then RowINC = 1: ColINC = 0: Direction = Down
Case Chr$(0) + "K"
If ColINC <> 1 Then ColINC = -1: RowINC = 0: Direction = Left
Case Chr$(0) + "M"
If ColINC <> -1 Then ColINC = 1: RowINC = 0: Direction = Right
Case " "
Item = 2
PauseMENU Item
If Item = -1 Then GoSub ReSTART:
End Select
Row = Row + RowINC
Col = Col + ColINC
'Lengthen snake if prey has been eaten
If Increase Then
SnakeLENGTH = SnakeLENGTH + 1
For n = SnakeLENGTH To SnakeLENGTH - 7 Step -1
Rattler(n).BodyPART = Rattler(n - 1).BodyPART
Next n
Increase = Increase - 1
'If snake length has been increased significantly, adjust speed
If Increase = 0 Then
Select Case SnakeLENGTH
Case 36 To 46: Speed = SetSPEED - 1
Case Is > 46: Speed = SetSPEED - 2
End Select
End If
End If
For n = SnakeLENGTH To 2 Step -1
Swap Rattler(n).Row, Rattler(n - 1).Row
Swap Rattler(n).Col, Rattler(n - 1).Col
Swap Rattler(n).TURN, Rattler(n - 1).TURN
Swap Rattler(n).WhichWAY, Rattler(n - 1).WhichWAY
Swap Rattler(n).RattleDIR, Rattler(n - 1).RattleDIR
Next n
If Direction <> OldDIRECTION Then
Rattler(2).TURN = TURN
Select Case OldDIRECTION
Case Up
Select Case Direction
Case Left: Rattler(2).WhichWAY = UL
Case Right: Rattler(2).WhichWAY = UR
End Select
Rattler(2).RattleDIR = Up
Case Down
Select Case Direction
Case Left: Rattler(2).WhichWAY = DL
Case Right: Rattler(2).WhichWAY = DR
End Select
Rattler(2).RattleDIR = Down
Case Left
Select Case Direction
Case Up: Rattler(2).WhichWAY = LU
Case Down: Rattler(2).WhichWAY = LD
End Select
Rattler(2).RattleDIR = Left
Case Right
Select Case Direction
Case Up: Rattler(2).WhichWAY = RU
Case Down: Rattler(2).WhichWAY = RD
End Select
Rattler(2).RattleDIR = Right
End Select
End If
Rattler(1).Row = Row
Rattler(1).Col = Col
Rattler(1).TURN = 0
Rattler(1).WhichWAY = Direction
Rattler(SnakeLENGTH).TURN = 0
Rattler(SnakeLENGTH - 1).TURN = 0