you had part answered your own question in the first post, as its to do with the return key press, because the machine run very fast a quick tap of the return key looks like a quick tap to us but to the machine you have done it 100 times or more.
So the bit you need to look at is to do with return key, need a switch.
heres what i added to your code to see what was going on, this slow it down just enough to see whats happening.
+ Code Snippet `set display mode to 1280 by 1024 with 32 bit colour
set display mode 1280,1024,32
`go to subroutine declare variables
gosub declarevar
`make the camera and position it with the var camy
make camera 1
position camera 1,0,camy,-20
`make 4 object 1 main, 2 sides, and the base
make object cube lvl,10
make object cube right,10
make object cube left,10
make object cube base,10
`hid ethe two side object and make the base be alpha mapped
hide object left
hide object right
set alpha mapping on base, 50
make object cube 6,10
make object cube 7,10
make object cube 8,10
hide object 6
hide object 7
hide object 8
position object 6,0,10,20
position object 7,0,20,20
position object 8,0,30,20
`position all the object at appropriate positions
position object lvl,x#,0,20
position object right,30,sy,20
position object left,-30,sy,20
position object base,0,-10,20
do
`call the two subroutines to move forward and backward
gosub moveforward
gosub moveback
loop
`***************************************************
`******************Subroutines**********************
`***************************************************
declarevar:
`declare object # of base
base as integer
base=4
`declare object # of right hidden block
right as integer
right=2
`declare object # of left hidden block
left as integer
left=3
`declare variable x# as decimal (x is the x position of the current object)
x# as float
x#=0
`declare variable for setting camera height
camy as integer
camy=10
`declare variable for the current block
lvl as integer
lvl=5
`declare the height or y position of current block
y as integer
y=0
`declare the height or y position of side blocks
sy as integer
sy=0
return
`SUBROUTINE MOVE FORWARD
moveforward:
`repeat the following until
repeat
`increase the x# variable upon every loop by 0.02(speed)
x#=x#+0.02
`reposition current object (lvl) with the new corrdinates
position object lvl,x#,y,20
`if enter is pressed go to subroutine nextlvl
if returnkey()=1
gosub nextlvl
endif
`continue the above until current object(lvl) and side block 2 collide
until object collision (lvl,2)=1
return
`SUBROUTINE MOVE BACKWARD
moveback:
repeat
x#=x#-0.02
position object lvl,x#,y,20
if returnkey()=1
gosub nextlvl
endif
until object collision (lvl,3)=1
return
nextlvl:
set alpha mapping on lvl, 50
y=y+10
lvl=lvl+1
rem added this bit <<<<<<<<<<<<<<<<<<<<<
print lvl
sync
wait key
rem <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
show object lvl
position object lvl,0,y,20
position object right,30,10,20
position object left,-30,10,20
return
Sasuke beat me to it, and put in the answer.