Petit Computer Wiki
Advertisement
G-ZERO
Image.A0ZJZW

General Info
Genre(s): Games, Racing
Contributor(s): Unknown/SmileBoom?
Release Date: July 29th, 2011
Development Status: Stable
Version: Unspecified
Size: 1620B
Mode(s): Single Player
Language(s): English


Another sample program from the Petit Computer Official Strategy Technic under the "100-Line Programming Corner" on page 94. It's a very simplified remnant of the Super Nintendo racing title F-ZERO. It doesn't use mode 7-like scaling, however.

Read more: http://petitcomputer.boards.net/thread/7/sample-zero#ixzz2YmVJEkOl

Download[]

https://raw.github.com/BrianXP7/petitcomputer/master/g_zero/qr/qr000.png

'---------- G-ZERO
CLS
CLEAR:DIM M$(8)
M$(0)="◤     ◥■"
M$(1)=" ◢■■■◣ ■"
M$(2)=" ■■■■■ ■"
M$(3)=" ■■■■■ ■"
M$(4)=" ■■■■◤ ■"
M$(5)=" ◥■◤  ◢■"
M$(6)="◣   ◢■■■"
M$(7)="■■■■■■■■"
'---------BG0
BGPAGE 0
L=0
FOR Y=0 TO 7
FOR X=0 TO 7
C=ASC(MID$(M$(Y),X,1))
CHRREAD("BGF0",C),BF$
FOR J=0 TO 7
FOR I=0 TO 7
A=VAL("&H"+MID$(BF$,I+J*8,1))
BX=I+X*8:BY=J+Y*8
C=RND(4)+363:PAL=11
IF A THEN C=RND(4)+378:PAL=3
BGPUT L,BX,BY,C,PAL,0,0
NEXT
NEXT
NEXT
NEXT
C=12
FOR BX=24 TO 31
FOR BY=0 TO 7
BGPUT L,BX,BY,C,PAL,0,0
NEXT
NEXT
'--------PLAYER INIT
PAL=2
SPPAGE 0:SPCLR
SPSET 0,178,PAL,0,0,1
SPSET 1,251,PAL,0,0,1
R=8*SQR(2)
Z=0:F=1:T1=0
X=128:Y=32:X1=0:Y1=0
A=180:A1=2:SMAX=8
'--------MAIN
@MAIN
B=BUTTON()
K=0.99
IF B AND 8 THEN A=A+A1
IF B AND 4 THEN A=A-A1
IF B AND 15 THEN K=0.98
IF A<0    THEN A=A+360
IF A>=360 THEN A=A-360
X1=X1*K:Y1=Y1*K
S=(X1*X1)+(Y1*Y1)
MX=-8:MY=-8
IF (B AND 16)==0 THEN @MOV0
IF S>SMAX THEN @MOV0
T=RAD((A+180)% 360)
X1=X1+COS(T)/20
Y1=Y1+SIN(T)/20
MX=COS(RAD(A))*Z+128
MY=SIN(RAD(A))*Z+98
Z=Z+1:S=S*700
IF Z>16 THEN Z=6:BEEP 1,S
@MOV0
SPOFS 1,MX-8,MY-8
SPANGLE 0,A
T=RAD((A+225)% 360)
MX=COS(T)*R+128
MY=SIN(T)*R+96
SPOFS 0,MX,MY
X=X+X1:Y=Y+Y1
BGREAD(L,X/8,Y/8),C,PAL,H,V
IF C>=378 THEN GOSUB @BOUND
BX=(X+(512-128))%512
BY=(Y+(512-96))%512
BGOFS L,BX,BY
VSYNC 1
GOSUB @TCHK
GOTO @MAIN
'----------
@BOUND
X1=-X1:Y1=-Y1:BEEP 13
RETURN
'----------TIME
@TCHK
I=FLOOR(X/64):J=FLOOR(Y/64)
IF I!=3 THEN RETURN
IF J!=6 AND J!=0 THEN RETURN
IF J==F THEN RETURN
F=J
IF F!=0 THEN RETURN
BEEP 7
T2=MAINCNTL
LOCATE 8,2:PRINT "TIMES:";
IF T1 THEN PRINT (T2-T1)/60;
PRINT " SEC    ":T1=T2
RETURN
GZEROqrs

And here are some QR codes, for those of you who don't want to try typing it in.

Advertisement