home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / oplexamp / EX_BOUNC.OPL < prev    next >
Text File  |  1992-08-27  |  584b  |  26 lines

  1. PROC bounce:
  2.     LOCAL posX%,posY%,changeX%,changeY%,k%
  3.     LOCAL scrx%,scry%
  4.     scrx%=40 :scry%=9
  5.     posX%=1    :posY%=1
  6.     changeX%=1 :changeY%=1
  7.     DO
  8.         posX%=posX%+changeX%
  9.         posY%=posY%+changeY%
  10.         IF posX%=1 OR posX%=scrx%
  11.             changeX%=-changeX%
  12.             REM at edge ball changes direction
  13.             BEEP 2, 600 REM low beep
  14.         ENDIF
  15.         IF posY%=1 or posY%=scry% REM same for y
  16.             changeY%=-changeY%
  17.             BEEP 2, 200 REM high beep
  18.         ENDIF
  19.         AT posX%,posY% :PRINT "0";
  20.         PAUSE 2     REM Try changing this
  21.         AT posX%,posY% :PRINT " ";
  22.         REM removes old `0' character
  23.         k%=KEY
  24.     UNTIL k%
  25. ENDP
  26.