我正在我的游戏设计课上为一个名为 Buzzwire 的游戏做一个合作伙伴任务。我已经多次检查了 10 页代码,虽然我发现了很多错误,但没有一个能摆脱我在最后一行说 GOTO TITLE 的语法错误。我最近错过了一天,这开始让我回到我在空闲时间甚至找不到它的地步。任何帮助将不胜感激。我很清楚要查看很多编码,但是我不知道如何捕获错误。*内置于程序 Dark Basic Pro。
set window on
show window
randomize timer()
set display mode 800,600,16
set window size 480,600
sync on
sync rate 0
hide mouse
cls rgb(0,0,0)
draw to front
dim wirex(100000)
dim wirey(100000)
dim wireshow(100000)
start:
load image "graphics/title.bmp",1
for t = 1 to 8
load image "graphics/wiretool.bmp",11
load image "graphics/toolother.bmp",12
load image "graphics/shock.bmp",13
load image "graphics/shock.bmp",14
load image "graphics/shock.bmp",15
load image "graphics/tooldetect.bmp",16
load image "graphics/chances.bmp",17
load image "graphics/base1.bmp",50
load image "graphics/base2.bmp",51
load image "graphics/title.bmp",52
load sound "sounds/buzzer.wav",1
load music "sounds/title.mid",1
load music "sounds/music1.mid", 2
load music "sounds/music2.mid",3
load music "sounds/music4.mid",4
load music "sounds/music5.mid",5
load music "sounds/music6.mid",6
load music "sounds/gameover.mid",7
load music "sounds/complete.mid",8
TITLE:
level=0
for t=1 to 8
if music playing(t)=1 then stop music t
next t
play music 1
buzz=0
loop sound 1
titlex:
for t=1 to 1000
if sprite exist(t)= 1 then delete sprite t
next t
cls rgb(0,0,0)
paste image 52,320,75,0
set window title "**** Welcome to Buzz Wire****"
set text font "Westminster"
set text to bold
set text size 32
ink rgb(255,255,0),rgb(255,255,0)
text 220,275,"<Space Bar> Start a New Game"
set text size 28
ink rgb(255,255,255),rgb(255,255,255)
text 150,350,"Welcome to Buzz Wire, programmed for the PC by"
text 150,380,"Austin Taylor"
ink rgb(0,250,0),rgb(0,255,0)
text 150,465,"<Mouse> Controls Buzzer During Game,"
text 150,495,"<Enter> Exit Game..."
if mouseclick()=1 or inkey$()=" " then stop sound 1:goto 1
if inkey$()=chr$(13) then end
buzz=buzz+1
if buzz>20 then buzz=20
if buzz=20 then STOP sound 1
ink rgb(255,255,255),rgb(255,255,255)
ty=100
for t=1 to 4
for tx=0 to 800 step 20
td=ty
ty=ty-rnd(20)+rnd(20)
if ty<80 then ty=80
if ty>120 then ty=120
line tx-20,td,tx,ty
next tx
next t
sync
goto titlex
1:
for t=1 to 1000
if sprite exist(t)=1 then delete sprite t
next t
for t=1 to 8
if sprite exist(t)=1 then stop music t
next t
scrx=0:scry=0
no=0
nox=20
noxx=20
x=0:y=0
xx=0:yy=0
detext=0
leveltype=0
cl=2
clx=2
tmrgo=0
for t= 1 to 100000
wirex(t)=0
wirey(t)=0
wireshow(t)=0
next t
chance=15
levelx=0
level=level+1
if level=1 then lvltype=1:levelx=0:stop music 1:play music 2
if level=2 then lvltype=1:levelx=0:chance=14:stop music 2:play music 3
if level=3 then lvltype=1:levelx=0:chance=12:stop music 2:play music 3
if level=4 then lvltype=1:levelx=0:chance=10:stop music 3:play music 4
if level=5 then lvltype=2:levelx=1:chance=8:stop music 3:play music 4
if level=6 then lvltype=2:levelx=1:chance=5:stop music 4:play music 5
if level=7 then lvltype=2:levelx=1:chance=5:stop music 4:play music 5
if level=8 then lvltype=2:levelx=1:chance=4:stop music 5:play music 6
if level=9 then goto complete
for ty=580 to 250 step -5
no=no+1
wirex(no)=150
wirey(no)=ty
next ty
tx=150
ty=250
si=0:sii=1
game1:
if rnd(20)=0 then si=rnd(1)
if ty<150 then si=1
if ty>450 then si=0
if si=0 then tx=tx+5:ty=ty-5
if si=1 then tx=tx+5:ty=ty+5
if tx>875 then goto game2
no=no+1
wirex(no)=tx
wirey(no)=ty
if levelx=1 then if rnd(100)=0 and tx>100 then gosub wire
goto game1
wire:
tspi=0:tspii=-5
tgo=0
tmr=0
wirex:
tmr=tmr+1:if tmr=2 then tmr=0
if tmr=0 then if rnd(20)=0 then tspi=-5+rnd(10)
rem if tmr=0 then if rnd(50)=0 then tspii=-5+rnd(10)
ty=ty+tspi
tx=tx+tspii
if tx<50 then goto wirex2
tmr=tmr+1:if tmr>50+rnd(100) then si=rnd(1):goto wirex2
no=no+1
wirex(no)=tx
wirey(no)=ty
goto wirex
wirex1:
tmr=tmr+1:if tmr=2 then tmr=0:tii=tii+1
tx=tx+tii
if ti=0 then ty=ty-5
if ti=1 then ty=ty+5
if tii>0 then goto wirex2
no=no+1
wirex(no)=tx
wirey(no)=ty
GOTO WIREX1
WIREX2:
RETURN
GAME2:
FOR TYY = TY TO 580 STEP 5
NO = NO + 1
WIREX(NO) = TX
WIREY(NO) = TYY
NEXT TYY
WIRESPR = 1 + LEVEL
XX = WIREX(20) - 18
YY = WIREY(20)
SHOCK = 0
2:
CLS RGB(0,0,0)
S = XX:D=YY
X = MOUSEMOVEX()
Y = MOUSEMOVEY()
XX=XX+X
YY=YY+Y
SCRX = 380 - XX
SCRY = 250 - YY
IF SCRX>0 THEN SCRX = 0
IF SCRX<-225 THEN SCRX = -225
IF SCRY<-100 THEN SCRY = -100
SET WINDOW TITLE "BUZZ WIRE LEVEL :- "+STR$(LEVEL)+" CHANCES :- "+STR$(CHANCE)
IF LEVELX=0 THEN PASTE IMAGE 50,SCRX+2,SCRY+500,0
IF LEVELX=1 THEN PASTE IMAGE 51,SCRX+110,SCRY+562,0
IF OK = 1 THEN SPRITE NO + 12,-500,-500,11
IF OK = 0 THEN SPRITE NO + 12,-500,-500,13+RND(2)
PASTE SPRITE NO + 12,SCRX+XX,SCRY+YY
OK = 0
SPR = 10
OKGO = 0
CL = 2
TMRGO = TMRGO+1
IF TMRGO = 2 THEN TMRGO = 0:CLX=CLX+1:IF CLX=9 THEN CLX=2
CL = CLX
FOR T = 1 TO NO
SPR = SPR + 1
IF LVLTYPE = 2 THEN CL = CL-1:IF CL = 1 THEN CL = 8
IF LVLTYPE = 0 THEN SPRITE SPR,SCRX+WIREX(T),SCRY+WIREY(T),WIRESPR
IF LVLTYPE = 1 THEN SPRITE SPR,SCRX+WIREX(T),SCRY+WIREY(T),8
IF LVLTYPE = 2 THEN SPRITE SPR,SCRX+WIREX(T),SCRY+WIREY(T),CL
IF LVLTYPE = 1 OR LVLTYPE = 2 THEN IF SPR>NOXX THEN SPRITE SPR,SCRX+WIREX(T),SCRY+WIREY(T),WIRESPR
IF DETECT = SPR THEN NOX = SPR
IF NOX>NOXX AND NOX<NOXX+20 THEN NOXX=NOX
REM IF SPRITE COLLISION(NO+3,SPR) THEN OK = 1
NEXT T
REM NOXX=NOX
SPRITE NO+13,SCRX+XX,SCRY+YY,12
SPRITE NO+14,SCRX+XX+12,SCRY+YY+18,16
SET SPRITE NO + 14,1,1
HIDE SPRITE NO + 14
DETECT=SPRITE COLLISION(NO+14,0)
IF DETECT>0 AND DETECT<NO+10 THEN OK =1
IF OK = 0 THEN XX=S:YY=D
IF OK = 0 THEN IF SOUND PLAYING(1) = 0 THEN PLAY SOUND 1:CHANCE=CHANCE-1
IF CHANCE = 0 THEN GOTO GAMEOVER
REM IF OK = 1 THEN STOP SOUND 1
REM SPRITE NO + 2,XX,YY,12
REM IF OK = 0 THEN XX=S:YY=D
IF XX>WIREX(NO)-50 AND XX<WIREX(N0)+50 AND YY>WIREY(NO)-50 AND YY<WIREY(NO)+50 THEN GOTO LVL
FOR TX = 0 TO (CHANCE-1)*20 STEP 20
PASTE IMAGE 17,TX,0,0
NEXT TX
IF INKEY$()=CHR$(13) THEN END
SYNC
GOTO 2
LVL:
FOR T = 1 TO NO+14
IF SPRITE EXIST(T)=1 THEN DELETE SPRITE T
NEXT T
GOTO 1
GAMEOVER:
FOR T = 1 TO 1000
IF SPRITE EXIST(T) = 1 THEN DELETE SPRITE T
NEXT T
FOR T = 1 TO 8
IF MUSIC PLAYING(T)=1 THEN STOP MUSIC T
NEXT T
TMR = 0
PLAY MUSIC 7
GAMEOVERX:
CLS RGB(0,0,0)
SET TEXT FONT "WESTMINSTER"
SET TEXT SIZE 64
INK RGB(255,255,196),RGB(255,255,196)
CENTER TEXT 400,250,"GAME OVER!"
TMR = TMR + 1
IF MOUSECLICK() = 1 OR INKEY$()=" " THEN GOTO TITLE
SYNC
IF TMR<40 THEN GOTO GAMEOVERX
GOTO TITLE
COMPLETE:
FOR T = 1 TO 1000
IF SPRITE EXIST(T)=1 THEN DELETE SPRITE T
NEXT T
FOR T = 1 TO 8
IF MUSIC PLAYING(T) = 1 THEN STOP MUSIC T
NEXT T
TMR = 0
PLAY MUSIC 8
COMPLETEX:
CLS RGB(0,0,196)
TI = 20
TY = 480
INK RGB(255,255,255),RGB(255,255,255)
BOX 0,0,799,599
INK RGB(0,0,196),RGB(0,0,196)
BOX 2,2,794,594
INK RGB(0,255,0),RGB(0,255,0)
FOR T = 1 TO 20
TI=TI-1
TY=TY-TI
LINE 0,TY,800,TY
NEXT T
FOR TX=0 TO 900 STEP 20
LINE TX,280,TX-100,380
NEXT TX
SET TEXT FONT "WESTMINSTER"
SET TEXT SIZE 64
INK RGB(RND(255),RND(255),RND(255)),RGB(RND(255),RND(255),RND(255))
CENTER TEXT 400,250,"****CONGRATULATIONS!****"
INK RGB(RND(255),RND(255),RND(255)),RGB(RND(255),RND(255),RND(255))
IF RND(2)>0 THEN INK RGB(255,255,0),RGB(255,255,255)
CENTER TEXT 401,249,"****CONGRATULATIONS!****"
TY = 285
FOR T = 1 TO 4
FOR TX = 0 TO 800 STEP 20
TD = TY
TY = TY-RND(20)+RND(20)
IF TY<250 THEN TY = 250
IF TY>310 THEN TY = 310
LINE TX-20,TD,TX,TY
NEXT TX
NEXT T
TMR=TMR+1
SYNC
IF MOUSECLICK()=1 THEN PLAY SOUND 1:GOTO TITLE
IF TMR<200 THEN GOTO COMPLETEX
GOTO TITLE