-
Notifications
You must be signed in to change notification settings - Fork 0
/
snake.bas
52 lines (44 loc) · 1.46 KB
/
snake.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
#C64Studio.MetaData.BASIC:2049,BASIC V2
100 REM INIT CHARACTERS ARRAY FOR CURVES
110 FOR I = 1 TO 4 : FOR J = 1 TO 4 : READ K(J,I) : NEXT J : NEXT I
120 DATA 66,75,0,74,85,67,74,0,0,73,66,85,73,0,75,67
130 REM PRINT WELCOME SCREE
132 PRINT CHR$ (147) : POKE 53280,0 : POKE 53281,0
142 PRINT "XMAS SNAKE"
152 PRINT "ROSARIO DE CHIARA"
159 PRINT "WWW.DECHIARA.EU"
166 POKE 198,0:WAIT 198,1
168 REM INIT INCREMENT ARRAY
170 DR(1) = - 40 : DR(2) = 1 : DR(3) = 40 : DR(4) = - 1
180 REM INIT SCORE
190 SC=0
200 REM INIT LEVEL
210 X = 1024 + 20 + 23 * 40:D = 2
220 FOR I = 1 TO L : POKE X - I,67 : NEXT I
221 PRINT CHR$ (147)
230 GOSUB 400
240 REM GAME LOOP
250 J = NOT PEEK (56320) : PD = D
260 IF (J AND 1) THEN D = 1
270 IF (J AND 2) THEN D = 3
280 IF (J AND 4) THEN D = 4
290 IF (J AND 8) THEN D = 2
300 IF K(PD,D) = 0 THEN D = PD
310 POKE X,K(PD,D)
320 IF RND(1)<0.3 THEN POKEX,81:POKEX+54272,RND(1)*10+1
330 X = X + DR(D):SC=SC+10
340 PRINT " PUNTI: ";SC
350 IF PEEK(X)=32THENTT$="SEI CADUTO!":GOSUB480:POKE 198,0:WAIT 198,1:END
360 IF PEEK(X)=42THENTT$="BUON NATALE!":GOSUB480:POKE 198,0:WAIT 198,1:GOTO200
370 GOTO 240
400 REM INIT XMAS TREE
410 I=0
420 PRINT TAB(20)"*":A$=""
430 PRINT TAB(20-I)A$ : I = I + 1
440 A$ = "" + A$ + ""
450 PRINT TAB(20-I)A$
460 IF I < 11 GOTO 430
470 RETURN
480 REM PRINT CENTERED TEXT
490 TX=INT(20-LEN(TT$)/2)
500 POKE 781,2:POKE 782,TX:POKE 783,0:SYS 65520:PRINTTT$:RETURN