I got my background to scroll when the ball gets close to each side. The problem I have is I can't get the screen to stop scrolling. Also the ball stops moving once it reaches the end of the background but the background scrolls right out of risibility. Any help would be great. Thanks.
do
remstart
if GetSpriteInBox ( ball1, 55, 55, 55, 55 )
setSpritePosition (ball1, 50,50)
endif
remend
x# = GetDirectionX ( )
y# = GetDirectionY ( )
SetSpritePosition ( ball1, GetSpriteX ( ball1 ) + x#, GetSpriteY ( ball1 ) + y# )
if ( GetSpriteX ( ball1 ) < 1 )
SetSpriteX ( ball1 , 1 )
endif
if ( GetSpriteX ( ball1 ) > 640 )
SetSpriteX ( ball1 ,640 )
endif
if ( GetSpriteY ( ball1 ) < 1 )
SetSpriteY (ball1, 1)
endif
if ( GetSpriteY (ball1 ) > 960 )
SetSpriteY ( ball1, 960 )
endif
if getrawkeystate(27)=1 then end
SetViewOffset ( vert, hor )
if ( GetSpriteInBox ( ball1, 90, 0, 100, 100 ) )
repeat
vert = vert + 1
until (vert => 200)
elseif (GetSpriteInBox ( ball1, 0, 90, 200, 200 ))
repeat
hor = hor + 1
until (hor => 200)
elseif (getSpriteX(ball1) =< 15)
repeat
vert = vert - 1
until (vert =< 1)
elseif (getSpriteY(ball1) =< 15)
repeat
hor = hor -1
until (hor =< 1)
endif
Sync()
loop