var groundposx : int
var groundposy : int
var chars : array char of boolean
var decgrnddrw : int
var groundexist : int := 1
var lineupground : int := 1
setscreen ("graphics:320;240")
Draw.FillBox(0,0,320,240,53) % Draw the BG
groundposx := 320
groundposy := 0
loop
if groundexist = 0 and lineupground > 131 and lineupground < 160 then
Draw.FillBox(160,5,140,15,13)
else
Draw.FillBox(160,15,140,30,13)
end if
Input.KeyDown (chars)
if chars ('j') then
decgrnddrw := Rand.Int (0,1)
if
decgrnddrw not= 0 then
Draw.FillBox(groundposx - 15,groundposy,groundposx,groundposy + 15,114)
groundposx := groundposx - 15
delay (30)
else
Draw.FillBox(groundposx - 15,groundposy,groundposx,groundposy + 15,53)
lineupground := groundposx
groundposx := groundposx - 15
delay (30)
groundexist := 0
end if
end if
if chars ('l') then
Draw.FillBox(groundposx - 15,groundposy,groundposx,groundposy + 15,114)
groundposx := groundposx + 15
delay (30)
end if
if groundposx < -15 then
groundposx := 320
end if
if groundposx > 320 then
groundposx := 320
end if
end loop