'===========================================================================
' Subject: BOUNCING TEXT                      Date: 10-19-97 (09:09)       
'  Author: Alexander Meyer                    Code: QB, QBasic, PDS        
'  Origin: Meyer.Karl@t-online.de           Packet: TEXT.ABC
'===========================================================================
'                             ////
'                           0(o o)0
'-------------------------ooO (_) Ooo---------------------
' BOUNCTXT.BAS -- Written in QuickBasic 4.5
'
' Name: Bouncing text
' Author: Alexander Meyer
' Date: 10-18-1997
' Description: This is a little nice program that shows
'              a bouncing text  ;-)
'
'For questions or comments mail to: Meyer.Karl@t-online.de
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

DECLARE SUB BouncingText (Text$, x, y, Breit, Hoch, Delay)

SCREEN 0: WIDTH 80         '--> Textmode 80 x 25

'Call routine
CALL BouncingText("Hello!!", 1, 1, 50, 20, 300)

END

SUB BouncingText (Text$, x, y, Breit, Hoch, Delay)

'**Bouncing text routine**

xRand = x
yRand = y
Breit = Breit + y
Hoch = Hoch + x

DO

LOCATE x, y: PRINT Text$       '--> Print text

FOR i = 1 TO Delay: NEXT i     '--> Delay

CLS                            '--> Clear screen

IF GoX = 0 THEN
  x = x + 1
  IF x >= Hoch THEN
    GoX = 1
    IF x = Hoch THEN
      x = x + 1
      GoX = 1
    END IF
  END IF
END IF

IF GoX = 1 THEN
  x = x - 1
  IF x <= xRand THEN GoX = 0
END IF

IF GoY = 0 THEN
  y = y + 1
  IF y >= Breit THEN GoY = 1
END IF

IF GoY = 1 THEN
  y = y - 1
  IF y <= yRand THEN GoY = 0
END IF

LOOP UNTIL INKEY$ <> ""

END SUB
