`start screen
set text size 75
text 70,120, "Traffic Frog"
set text size 10
text 80,320, "Direct the frog safely across the road using the arrow keys"
text 230,450, "Press any key to start"
wait key
 
`hide mouse
hide mouse
 
`dimensions
dim speed# (12)
dim place# (12)
 
do
 
`clearscreen
cls
 
`make the road and the markings
text 0,10,"________________________________________________________________________________"
text 0,440,"________________________________________________________________________________"
text 0,70,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
text 0,130,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
text 0,190,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
text 0,250,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
text 0,310,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
text 0,370,"___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___"
 
`make the sheep
ink rgb(0,255,0),0
text 300+x#,460+y#,"<o>"
 
ink rgb(255,255,255),0
`make the cars going to the right
for carright=1 to 6
speed#(carright)=speed#(carright)+(rnd(800/100.00))+rnd(2.00)
place#(carright)=(60*carright)
text speed#(carright),place#(carright),"[ ]"
if speed#(carright)>620 then speed#(carright)=0-rnd(20)
if x# = speed#(carright) and if -y# = place#(carright)
cls
text 0,0,"Game Over"
x#=0
y#=0
text 0,10,"Hit Any Key To Restart"
wait key
endif
`print speed#(carright)
`print place#(carright)
next carright
 
`print x#
`print -y#
 
`make the cars going to the left
for carleft=7 to 12
speed#(carleft)=speed#(carleft)-(rnd(800/100.00))-rnd(2.00)
place#(carleft)=40+(60*(13-carleft))
text speed#(carleft),place#(carleft),"[ ]"
if speed#(carleft)<0 then speed#(carleft)=620+rnd(20)
if x# = speed#(carleft) and if -y#= place#(carleft)
cls
text 0,0,"Game Over"
x#=0
y#=0
text 0,10,"Hit Any Key To Restart"
wait key
endif
`print speed#(carleft)
`print place#(carleft)
next carleft
 
`set controls for the sheep
if upkey()=1
y#=y#-2
endif
 
if downkey()=1
y#=y#+2
endif
 
if leftkey()=1
x#=x#-2
endif
 
if rightkey()=1
x#=x#+2
endif
 
`set screen limits
if x#>320
x#=320
endif
 
if x#<-300
x#=-300
endif
 
if y#>0
y#=0
endif
 
if y#<-460
y#=-460
endif
 
loop