`Setup
Sync on : Sync rate 60
Hide mouse
 
`Arrays
dim carx(2,5)
Dim cary(2,5)
dim ocarx(2,5)
dim carspd(2,5)
dim carpartx(2,5)
dim carparty(2,5)
dim ocarpartx(2,5)
dim ocarparty(2,5)
dim car$(2)
 
`Create vehicles
car$(1)="/S"
car$(2)="/Z"
 
`Create Frog
frog$="/"
frog1$="/"
frog2$="--"
move=1
 
`Init
x=screen width()/2
y=screen height()-10
carx(1,1)=0
carx(1,2)=-10
carx(1,3)=-100
carx(1,4)=-150
carx(1,5)=-50
cary(1,1)=110
cary(1,2)=150
cary(1,3)=200
cary(1,4)=210
cary(1,5)=160
carspd(1,1)=3
carspd(1,2)=2
carspd(1,3)=4
carspd(1,4)=5
carspd(1,5)=3
 
carx(2,1)=640
carx(2,2)=670
carx(2,3)=700
carx(2,4)=650
carx(2,5)=800
cary(2,1)=350
cary(2,2)=370
cary(2,3)=360
cary(2,4)=340
cary(2,5)=330
carspd(2,1)=3
carspd(2,2)=2
carspd(2,3)=4
carspd(2,4)=5
carspd(2,5)=3
 
for c=1 to 5
ocarx(1,c)=carx(1,c)
ocarx(2,c)=carx(2,c)
carpartx(1,c)=0
carparty(1,c)=0
ocarpartx(1,c)=carpartx(1,c)
ocarparty(1,c)=carparty(1,c)
carpartx(2,c)=0
carparty(2,c)=0
ocarpartx(2,c)=carpartx(2,c)
ocarparty(2,c)=carparty(2,c)
next c
 
`**Main Loop**
Do
 
`Create Road
ink rgb(128,128,128),0
text 1,100,"—————————————————————————————————————————————————————————————————————————————————"
ink rgb(255,255,255),0
text 1,screen height()/2,"---------------------------------------------------------------------------------"
ink rgb(128,128,128),0
text 1,screen height()-100,"—————————————————————————————————————————————————————————————————————————————————"
ink rgb(0,255,0),0
for r=1 to 10
text screen width()/12*r,85,"@"
next r
for r=1 to 60
text 1*r,85,"@"
next r
for r=535 to screen width()
text 1*r,85,"@"
next r
 
`Control Player
if upkey()=1 then inc um else um=0
if downkey()=1 then inc dm else dm=0
if leftkey()=1 then inc lm else lm=0
if rightkey()=1 then inc rm else rm=0
if um>7
y=y-5 : um=0 : move=move+1
endif
if dm>7
y=y+5 : dm=0 : move=move+1
endif
if lm>7
x=x-5 : lm=0 : move=move+1
endif
if rm>7
x=x+5 : rm=0 : move=move+1
endif
if move>1 then move=0
if move=1 then frog$=frog1$
if move=0 then frog$=frog2$
 
`Draw Player
ink rgb(0,255,0),0
text x,y,frog$
 
`Trucks and cars
for c=1 to 5: carx(1,c)=carx(1,c)+carspd(1,c) : next c
for c=1 to 5: carx(2,c)=carx(2,c)-carspd(2,c) : next c
 
`Draw Trucks and Cars
ink rgb(255,255,255),0
for c=1 to 5
text carx(1,c),cary(1,c),car$(1)
if carx(1,c)>screen width()+text width(car$(1)) then carx(1,c)=ocarx(1,c)
 
text carx(2,c),cary(2,c),car$(2)
if carx(2,c)<0-text width(car$(2)) then carx(2,c)=ocarx(2,c)
 
next c
 
`Draw car particles
ink rgb(100,100,100),0
for c=1 to 5
inc life
if life>0 and life<20
carpartx(1,c)=carpartx(1,c)-1
carparty(1,c)=carparty(1,c)-1
carpartx(2,c)=carpartx(2,c)+1
carparty(2,c)=carparty(2,c)-1
endif
if life>20 then life=0 : carpartx(1,c)=ocarpartx(1,c) : carparty(1,c)=ocarparty(1,c) : carpartx(2,c)=ocarpartx(2,c) : carparty(2,c)=ocarparty(2,c)
text carx(1,c)+carpartx(1,c),cary(1,c)+carparty(1,c),"#"
text carx(2,c)+carpartx(2,c)+text width(car$(2)),cary(2,c)+carparty(2,c),"#"
next c
 
`Die
for c=1 to 5
if x>carx(1,c)-text width(car$(1)) and x<carx(1,c)+text width(car$(1))
if y>cary(1,c)-5 and y<cary(1,c)+5
y=squish_frog()
endif
endif
if x>carx(2,c)-text width(car$(2)) and x<carx(2,c)+text width(car$(2))
if y>cary(2,c)-5 and y<cary(2,c)+5
y=squish_frog()
endif
endif
next c
 
`Win
if y<90
y=win()
for c=1 to 5
carspd(1,c)=carspd(1,c)+1
carspd(2,c)=carspd(2,c)+1
next c
endif
 
 
`**End Loop**
Sync
cls
Loop
 
`**Functions**
Function Squish_frog()
 
do
ink rgb(255,0,0),0
center text 320,50,"Squish!!!"
inc lose
if lose>50 then exit
sync
loop
 
endfunction 470
 
 
Function win()
 
ink rgb(0,255,0),0
 
do
center text 320,50,"YAY! You won!!"
inc won
if won>50 then exit
sync
loop
 
Endfunction 470