sync on
sync rate 60
 
#CONSTANT faceup 0
#CONSTANT facedown 1
#CONSTANT faceleft 2
#CONSTANT faceright 3
#CONSTANT jumpup 4
#CONSTANT jumpdown 5
#CONSTANT squished 6
#CONSTANT drowned 7
 
global debounce as integer
 
global RED as DWORD
global GREEN as DWORD
global BLUE as DWORD
global YELLOW as DWORD
global WHITE as DWORD
global PALEBLUE as DWORD
global PALEGREEN as DWORD
global DARKBLUE as DWORD
global DARKGREEN as DWORD
global MIDGREEN as DWORD
global BROWN as DWORD
global LIGHTBROWN as DWORD
 
RED = rgb(255,0,0)
GREEN = rgb(0,255,0)
BLUE = rgb(0,0,255)
YELLOW = rgb(255,255,0)
WHITE = rgb(255,255,255)
PALEBLUE = rgb(128,128,255)
PALEGREEN = rgb(128,255,128)
DARKBLUE = rgb(0,0,128)
DARKGREEN = rgb(0,80,0)
MIDGREEN = rgb(0,140,0)
BROWN = rgb(128,64,0)
LIGHTBROWN = rgb(128,64,32)
 
 
type coordXY
 
   X as float
   Y as float
 
endtype
 
type frog
   Pos as coordXY
   blinktime as Float
   state as Integer
   walktime as Float
   jumptime as Float
   target as coordXY
endtype
 
type vehicle
   Pos as coordXY
   Colour as Integer
endtype
 
global Froggie as frog
dim Car(5) as vehicle
dim Truck(5) as vehicle
dim LogSmall(27) as vehicle
 
Froggie.Pos.X = screen width()/2
Froggie.Pos.Y = 500
Froggie.blinktime = 0
Froggie.state = faceup
Froggie.walktime = 0
Froggie.jumptime = 0
 
for i = 0 to array count(Car())/2
   Car(i).Pos.X = rnd(screen width())
   Car(i).Pos.Y = 410
   Car(i).Colour = rnd(2)
next i
for i = array count(Car())/2 to array count(Car())
   Car(i).Pos.X = rnd(screen width())
   Car(i).Pos.Y = 374
   Car(i).Colour = rnd(2)
next 1
 
for i = 0 to array count(Truck())/2
   Truck(i).Pos.X = rnd(screen width())
   Truck(i).Pos.Y = 290
   Truck(i).Colour = rnd(2)
next i
 
for i = array count(Truck())/2 to array count(Truck())
   Truck(i).Pos.X = rnd(screen width())
   Truck(i).Pos.Y = 318
   Truck(i).Colour = rnd(2)
next i
 
for i = 0 to 3
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 200
   LogSmall(i).Colour = 0
next i
 
for i = 4 to 7
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 176
   LogSmall(i).Colour = 1
next i
 
for i = 8 to 11
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 152
      LogSmall(i).Colour = 0
next i
 
for i = 12 to 15
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 128
   LogSmall(i).Colour = 1
next i
 
for i = 16 to 19
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 104
      LogSmall(i).Colour = 0
next i
 
for i = 20 to 23
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 80
   LogSmall(i).Colour = 1
next i
 
for i = 24 to 27
   LogSmall(i).Pos.X = rnd(screen width())
   LogSmall(i).Pos.Y = 56
      LogSmall(i).Colour = 0
next i
 
ink GREEN,0
 
`****************** MAIN LOOP ******************
 
do
cls
draw_staticcomponents()
get_movement()
move_cars()
draw_cars()
move_trucks()
draw_trucks()
move_logs()
draw_logs()
 
 
select Froggie.state
   case faceup                `************* FROGGIE STATE = FACEUP *************
      draw_frog()
   endcase
 
   case facedown              `************* FROGGIE STATE = FACEDOWN ***********
      draw_upsidedownfrog()
   endcase
 
   case jumpup                `************* FROGGIE STATE = JUMPUP *************
      do_jumpup()
      draw_frog()
   endcase
 
   case jumpdown              `************* FROGGIE STATE = JUMPDOWN ***********
      draw_upsidedownfrog()
      do_jumpdown()
   endcase
 
   case squished
      draw_squishedfrog()
      death_squish()
   endcase
 
   case drowned
      draw_drownedfrog()
      death_drowned()
   endcase
 
   case default
      draw_frog()
   endcase
endselect
 
if Froggie.state <> squished AND Froggie.state <> drowned
   check_collision()
endif
 
`print_ascii()
sync
loop
 
`************************************************ END OF MAIN LOOP ***********
`*****************************************************************************
 
`Check the keys for WASD movement.
Function get_movement()
 
if keystate(17) = 1 AND Froggie.state = faceup AND debounce = 0    `If 'W' pressed and facing up - JUMP!
   Froggie.state = jumpup
   debounce = 1
endif
 
if keystate(31) = 1 AND Froggie.state = facedown AND debounce = 0   `If 'S' pressed and facing down - JUMP!
   Froggie.state = jumpdown
   debounce = 1
endif
 
if Froggie.state < jumpup
   if keystate(17) = 1                          `W for up
      Froggie.walktime = Froggie.walktime +1
      Froggie.state = faceup
   endif
 
   if keystate(31) = 1                          `S for down
      Froggie.walktime = Froggie.walktime +1
      Froggie.state = facedown
   endif
 
   if keystate(30) = 1                          `A for left
      Froggie.Pos.X = Froggie.Pos.X -2
      Froggie.walktime = Froggie.walktime +1
   endif
 
   if keystate(32) = 1                          `D for right
      Froggie.Pos.X = Froggie.Pos.X +2
      Froggie.walktime = Froggie.walktime +1
   endif
endif
 
if keystate(17) = 0 AND keystate(31) = 0
   debounce = 0
endif
 
collide_screen()        `Do not allow outside screen boundries.
 
endfunction
 
`Stop Froggie from moving outside the screen shape.
Function collide_screen()
 
if Froggie.Pos.X <0+5
   Froggie.Pos.X = 0+5
endif
 
if Froggie.Pos.X > screen width() -10
   Froggie.Pos.X = screen width() -10
endif
 
if Froggie.Pos.Y < 0+25
   Froggie.Pos.Y = 0+25
endif
 
if Froggie.Pos.Y > screen height() -15
   Froggie.Pos.Y = screen height() -15
endif
 
endfunction
 
`Draw our froggie the right way up.  There are two animated states - leap and rest.
Function draw_frog()
 
ink GREEN,0
 
if Froggie.state = faceup     `Animation for 'rest'
   text Froggie.Pos.X-2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X+2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X-6,Froggie.Pos.Y+4,"="
   text Froggie.Pos.X+6,Froggie.Pos.Y+4,"="
   text Froggie.Pos.X-6,Froggie.Pos.Y-1,"\"
   text Froggie.Pos.X+6,Froggie.Pos.Y-1,"/"
endif
 
if Froggie.state = jumpup     `Animation for 'leap'
   text Froggie.Pos.X-2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X+2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X-5,Froggie.Pos.Y+3,"/"
   text Froggie.Pos.X-2,Froggie.Pos.Y+3,"/"
   text Froggie.Pos.X+5,Froggie.Pos.Y+3,"\"
   text Froggie.Pos.X+2,Froggie.Pos.Y+3,"\"
   text Froggie.Pos.X-7,Froggie.Pos.Y-1,"-"
   text Froggie.Pos.X+7,Froggie.Pos.Y-1,"-"
endif
 
if Froggie.walktime > 30
   Froggie.walktime = 0
endif
 
draw_frogeyes()            `Draw the eyes!  (Froggie blinks, so a different function for this)
 
endfunction
 
 
`Draw Froggies eyes (right way up)  He blinks over time.
Function draw_frogeyes()
 
ink WHITE,0
Froggie.blinktime = Froggie.blinktime +1
 
if Froggie.blinktime<200
   text Froggie.Pos.X-3,Froggie.Pos.Y-1,CHR$(176)
   text Froggie.Pos.X+3,Froggie.Pos.Y-1,CHR$(176)
else
   if Froggie.blinktime>200
      text Froggie.Pos.X-3,Froggie.Pos.Y-4,CHR$(172)
      text Froggie.Pos.X+3,Froggie.Pos.Y-4,CHR$(172)
   endif
endif
 
if Froggie.blinktime>205+rnd(10)
   Froggie.blinktime = 0
endif
 
endfunction
 
 
`Draw Froggie upsidedown.  Again, two animated 'frames'.
Function draw_upsidedownfrog()
 
ink GREEN,0
 
if Froggie.state = FACEDOWN
   text Froggie.Pos.X-2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X+2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X-6,Froggie.Pos.Y-4,"="
   text Froggie.Pos.X+6,Froggie.Pos.Y-4,"="
   text Froggie.Pos.X-6,Froggie.Pos.Y+1,"/"
   text Froggie.Pos.X+6,Froggie.Pos.Y+1,"\"
endif
 
if Froggie.state = JUMPDOWN
   text Froggie.Pos.X-2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X+2,Froggie.Pos.Y,CHR$(130)
   text Froggie.Pos.X-5,Froggie.Pos.Y-3,"\"
   text Froggie.Pos.X-2,Froggie.Pos.Y-3,"\"
   text Froggie.Pos.X+5,Froggie.Pos.Y-3,"/"
   text Froggie.Pos.X+2,Froggie.Pos.Y-3,"/"
   text Froggie.Pos.X-7,Froggie.Pos.Y+1,"-"
   text Froggie.Pos.X+7,Froggie.Pos.Y+1,"-"
endif
 
 
if Froggie.walktime > 30
   Froggie.walktime = 0
endif
 
draw_upsidedownfrogeyes()
 
endfunction
 
 
Function draw_upsidedownfrogeyes()
 
ink WHITE,0
Froggie.blinktime = Froggie.blinktime +1
 
if Froggie.blinktime<200
   text Froggie.Pos.X-3,Froggie.Pos.Y+8,CHR$(176)
   text Froggie.Pos.X+3,Froggie.Pos.Y+8,CHR$(176)
else
   if Froggie.blinktime>200
      text Froggie.Pos.X-3,Froggie.Pos.Y+4,CHR$(172)
      text Froggie.Pos.X+3,Froggie.Pos.Y+4,CHR$(172)
   endif
endif
 
if Froggie.blinktime>205+rnd(10)
   Froggie.blinktime = 0
endif
 
endfunction
 
 
 
Function do_jumpup()
 
if Froggie.jumptime = 0
   Froggie.target.Y = Froggie.Pos.Y - 30
   Froggie.target.X = Froggie.Pos.X
endif
 
Froggie.jumptime = Froggie.jumptime + 1
 
if Froggie.jumptime < 5
   Froggie.Pos.Y = Froggie.Pos.Y - 6
endif
 
if Froggie.jumptime = 5
   Froggie.jumptime = 0
   Froggie.state = faceup
endif
 
endfunction
 
 
Function do_jumpdown()
 
if Froggie.jumptime = 0
   Froggie.target.Y = Froggie.Pos.Y + 30
   Froggie.target.X = Froggie.Pos.X
endif
 
Froggie.jumptime = Froggie.jumptime + 1
 
if Froggie.jumptime < 5
   Froggie.Pos.Y = Froggie.Pos.Y + 6
endif
 
if Froggie.jumptime = 5
   Froggie.jumptime = 0
   Froggie.state = facedown
endif
 
endfunction
 
 
Function draw_staticcomponents()
 
halfsolidline$ = CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
solidline$ = halfsolidline$ + halfsolidline$ + halfsolidline$ + halfsolidline$
halfgrassverge$ = "\\/|\\/\|//|/\||/|/\/||\\\\/|/\\//||\\/|\\/\|//|/\||/|/\/||\\\\/|/\\\||/|/\/||\\\\/|/\\/\/||\\\\/|/\\\||/|/"
grassverge$ = halfgrassverge$ + halfgrassverge$ + halfgrassverge$
halfriverbank$ = "           ~            ~          ~           ~          ~            ~            ~"
riverbank$ = halfriverbank$ + halfriverbank$  + halfriverbank$
 
ink YELLOW,0
text 0,440,solidline$               `Draw the bottom road edge
text 5,440,solidline$
 
ink DARKGREEN,0                     `Draw the bottommost grass verge
text 0,444,grassverge$
ink MIDGREEN,0
text -20,448,grassverge$
ink WHITE,0
 
for i = 0 to (screen width()/80)    `Draw the dotted road lines.
   text i*80,340,"___"
   text i*80,341,"___"
next i
 
ink DARKGREEN,0                     `Draw the other verge to the road, the upper one.
text 0,250,grassverge$
ink MIDGREEN,0
text -20,247,grassverge$
ink YELLOW,0
 
text 0,260,solidline$               `Draw the top road edge
text 5,260,solidline$
 
ink DARKBLUE,0                      `Draw some randomish river blueness.
text 0,220,riverbank$
text -30,200,riverbank$
text 10,180,riverbank$
text -15,160,riverbank$
text -60,140,riverbank$
text 8,120,riverbank$
text -18,100,riverbank$
text -78,80,riverbank$
text 2,60,riverbank$
text -65,40,riverbank$
if rnd(10) = 1
   ink PALEBLUE,0
   text rnd(screen width()),rnd(100)+100,"^"
endif
ink DARKGREEN,0
text 0,217,grassverge$
ink MIDGREEN,0
text -20,220,grassverge$
ink WHITE,0
 
 
ink DARKGREEN,0
 
`********** FIRST LILLYPAD! ***********
text 50,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 53,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 45,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 50,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 45,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 50,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 50,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 53,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 54,47,CHR$(130)+"  "+CHR$(130)
text 57,47,CHR$(130)+"  "+CHR$(130)
 
`********** SECOND LILLYPAD!! ************
text 200,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 203,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 195,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 200,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 195,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 200,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 200,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 203,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 204,47,CHR$(130)+"  "+CHR$(130)
text 207,47,CHR$(130)+"  "+CHR$(130)
 
 
`********** THIRD LILLYPAD!! ************
text 350,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 353,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 345,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 350,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 345,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 350,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 350,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 353,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 354,47,CHR$(130)+"  "+CHR$(130)
text 357,47,CHR$(130)+"  "+CHR$(130)
 
 
`********** FOURTH LILLYPAD!! ************
text 500,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 503,20,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 495,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 500,28,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 495,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 500,36,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 500,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
text 503,44,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
text 504,47,CHR$(130)+"  "+CHR$(130)
text 507,47,CHR$(130)+"  "+CHR$(130)
 
endfunction
 
 
Function check_collision()
 
temp_check = 0
 
if Froggie.Pos.Y < 220
   temp_check = 1
endif
 
` CHECK FOR FIRST LILLYPAD
if Froggie.Pos.Y <48 AND Froggie.Pos.X > 43 AND Froggie.Pos.X < 93
   temp_check = 2
endif
 
` CHECK FOR SECOND LILLYPAD
if Froggie.Pos.Y <48 AND Froggie.Pos.X > 193 AND Froggie.Pos.X < 243
   temp_check = 2
endif
 
` CHECK FOR THIRD LILLYPAD
if Froggie.Pos.Y <48 AND Froggie.Pos.X > 343 AND Froggie.Pos.X < 393
   temp_check = 2
endif
 
` CHECK FOR FOURTH LILLYPAD
if Froggie.Pos.Y <48 AND Froggie.Pos.X > 493 AND Froggie.Pos.X < 543
   temp_check = 2
endif
 
`CHECK CAR COLLISION!!
for i = 0 to array count(Car())
 
if Froggie.Pos.Y > Car(i).Pos.Y-20 AND Froggie.Pos.Y < Car(i).Pos.Y+10 AND Froggie.Pos.X > Car(i).Pos.X - 18 AND Froggie.Pos.X < Car(i).Pos.X + 36
   temp_check = 3
endif
next i
 
`CHECK TRUCK COLLISION!!
for i = 0 to array count(Truck())
 
if Froggie.Pos.Y > Truck(i).Pos.Y-20 AND Froggie.Pos.Y < Truck(i).Pos.Y+10 AND Froggie.Pos.X > Truck(i).Pos.X - 18 AND Froggie.Pos.X < Truck(i).Pos.X + 63
   temp_check = 3
endif
next i
 
`CHECK LOG COLLISION!!
for i = 0 to array count(LogSmall())
 
if Froggie.Pos.Y > LogSmall(i).Pos.Y-20 AND Froggie.Pos.Y < LogSmall(i).Pos.Y+20 AND Froggie.Pos.X > LogSmall(i).Pos.X - 60 AND Froggie.Pos.X < LogSmall(i).Pos.X + 10
   temp_check = 0
   if LogSmall(i).Colour = 0
      froggie_momentum = -1
   else
      froggie_momentum = 1
   endif
endif
next i
 
if froggie_momentum = -1
   Froggie.Pos.X = Froggie.Pos.X - 1
endif
 
if froggie_momentum = 1
   Froggie.Pos.X = Froggie.Pos.X + 1
endif
 
 
if temp_check = 1
   ink BLUE,0
   Froggie.walktime = 0
   Froggie.state = drowned
 
endif
 
if temp_check = 2
   set cursor screen width()/2-(text width("WIN WIN WIN WIN WIN!")/2),screen height()/2
   Print "WIN WIN WIN WIN WIN!"
 
endif
 
if temp_check = 3
   Froggie.walktime = 0
   Froggie.state = squished
endif
 
endfunction
 
 
Function draw_cars()
 
for i = 0 to array count(Car())
   if Car(i).Colour = 0
      ink RED,0
   else
      if Car(i).Colour = 1
         ink YELLOW,0
      else
         if Car(i).Colour = 2
            ink PALEBLUE,0
         endif
      endif
   endif
   text Car(i).Pos.X,Car(i).Pos.Y,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
   text Car(i).Pos.X-3,Car(i).Pos.Y,"("+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
   text Car(i).Pos.X+6,Car(i).Pos.Y-9,"/"+CHR$(130)+CHR$(130)+"\"
   text Car(i).Pos.X+3,Car(i).Pos.Y-9," "+CHR$(130)+CHR$(130)+CHR$(130)
   ink DARKBLUE,0
   text Car(i).Pos.X+2,Car(i).Pos.Y+3,"o  o"
 
next i
 
ink WHITE,0
 
endfunction
 
 
Function move_cars()
 
for i = 0 to array count(Car())
 
if Car(i).Colour = 0
   speed = 3
else
   speed = 2
endif
 
Car(i).Pos.X = Car(i).Pos.X - speed
 
if Car(i).Pos.X < -30
   Car(i).Pos.X = screen width()+10+rnd(20)
   Car(i).Colour = rnd(2)
endif
 
next i
 
endfunction
 
 
Function draw_trucks()
 
for i = 0 to array count(Truck())
   if Truck(i).Colour = 0
      ink RED,0
   else
      if Truck(i).Colour = 1
         ink YELLOW,0
      else
         if Truck(i).Colour = 2
            ink PALEBLUE,0
         endif
      endif
   endif
   text Truck(i).Pos.X,Truck(i).Pos.Y-9,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+" "+CHR$(130)
   text Truck(i).Pos.X-3,Truck(i).Pos.Y-9,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+" "+CHR$(130)+"\"
 
   text Truck(i).Pos.X,Truck(i).Pos.Y,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+"="+CHR$(130)
   text Truck(i).Pos.X-3,Truck(i).Pos.Y,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+"="+CHR$(130)+CHR$(130)
   ink DARKBLUE,0
   text Truck(i).Pos.X-2,Truck(i).Pos.Y+4,"O   O O"
 
next i
 
ink WHITE,0
 
endfunction
 
 
 
Function move_trucks()
 
for i = 0 to array count(Truck())
 
if Truck(i).Colour = 0
   speed = 3
else
   speed = 2
endif
 
 
Truck(i).Pos.X = Truck(i).Pos.X + speed
 
if Truck(i).Pos.X > screen width()+30
   Truck(i).Pos.X = -30-(rnd(10))
   Truck(i).Colour = rnd(2)
endif
 
next i
 
endfunction
 
 
Function reset_player()
wait 100
Froggie.Pos.X = screen width()/2
Froggie.Pos.Y = 500
Froggie.State = FACEUP
 
endfunction
 
 
 
 
Function draw_logs()
 
for i = 0 to array count(LogSmall())
   ink BROWN,0
   text LogSmall(i).Pos.X-50,LogSmall(i).Pos.Y-4,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
   text LogSmall(i).Pos.X-47,LogSmall(i).Pos.Y-4,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
   text LogSmall(i).Pos.X-50,LogSmall(i).Pos.Y,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
   text LogSmall(i).Pos.X-47,LogSmall(i).Pos.Y,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
 
   text LogSmall(i).Pos.X-50,LogSmall(i).Pos.Y+4,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
   text LogSmall(i).Pos.X-47,LogSmall(i).Pos.Y+4,CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)+CHR$(130)
next i
 
endfunction
 
 
Function move_logs()
 
for i = 0 to array count(LogSmall())
 
if LogSmall(i).Colour = 0
   speed = -1
else
   speed = 1
endif
 
 
LogSmall(i).Pos.X = LogSmall(i).Pos.X + speed
 
 
if LogSmall(i).Colour = 1
   if LogSmall(i).Pos.X > screen width()+30
      LogSmall(i).Pos.X = -30-(rnd(10))
   endif
endif
 
if LogSmall(i).Colour = 0
   if LogSmall(i).Pos.X < -30
      LogSmall(i).Pos.X = screen width()+10+rnd(20)
   endif
endif
 
next i
 
 
endfunction
 
 
Function death_squish()
 
Froggie.walktime = Froggie.walktime + 1
 
if Froggie.walktime > 80
   reset_player()
endif
 
endfunction
 
 
Function draw_squishedfrog()
 
ink RED,0
 
text Froggie.Pos.X,Froggie.Pos.Y,"#"
text Froggie.Pos.X+3,Froggie.Pos.Y-2,"#"
text Froggie.Pos.X-4,Froggie.Pos.Y-1,"#"
text Froggie.Pos.X+1,Froggie.Pos.Y+3,"#"
 
text Froggie.Pos.X-(text width("SQUISH!")/2)+5,Froggie.Pos.Y-20,"SQUISH!"
 
endfunction
 
 
Function draw_drownedfrog()
 
if Froggie.walktime<5
   ink PALEBLUE,0
endif
 
if Froggie.walktime>5
   ink BLUE,0
endif
 
if Froggie.walktime>10
   ink DARKBLUE,0
endif
 
text Froggie.Pos.X-2,Froggie.Pos.Y,CHR$(130)
text Froggie.Pos.X+2,Froggie.Pos.Y,CHR$(130)
text Froggie.Pos.X-5,Froggie.Pos.Y+3,"/"
text Froggie.Pos.X-2,Froggie.Pos.Y+3,"/"
text Froggie.Pos.X+5,Froggie.Pos.Y+3,"\"
text Froggie.Pos.X+2,Froggie.Pos.Y+3,"\"
text Froggie.Pos.X-7,Froggie.Pos.Y-1,"-"
text Froggie.Pos.X+7,Froggie.Pos.Y-1,"-"
 
   text Froggie.Pos.X-(text width("SPLOOSH!")/2)+5,Froggie.Pos.Y-20,"SPLOOSH!"
 
endfunction
 
 
Function death_drowned()
 
Froggie.walktime = Froggie.walktime + 1
 
if Froggie.walktime > 100
   reset_player()
endif
 
endfunction
 
 
 
 
 
 
 
 
Function print_ascii()
 
for i = 130 to 160
print "Ascii:",i," = ",chr$(i)
next i
 
endfunction