home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / resource / gmatter / catalog / credits.dxr / 00009_pongBallMove.ls < prev    next >
Encoding:
Text File  |  1996-03-10  |  3.4 KB  |  81 lines

  1. on pongBallMove
  2.   global giPongBallChannel, giPongPaddleChannel, giPongBrickChannel, giBallVH, giBallMaxVV, giBallMaxVH, giPaddleBounceAngle, giBallVV, giPongEasyMode, giPlayFieldLeftBoundary, giPlayFieldRightBoundary, giPlayFieldTopBoundary, giPlayFieldBottomBoundary, giPongScore, giBrickVOffset, giBrickHOffset, glWallChannels, glBrickList, giHideOffset, giPaddleHalfWidth, giPaddleQuarterWidth, giPongStraightThru, giBallMinTicks, giHitsOnDelay, glBallsInPlay, giPongSplashChannel
  3.   set newLocH to the locH of sprite giPongBallChannel + giBallVH
  4.   if (newLocH > giPlayFieldRightBoundary) or (newLocH < giPlayFieldLeftBoundary) then
  5.     set giBallVH to -giBallVH
  6.     set newLocH to newLocH + giBallVH + giBallVH
  7.     puppetSound("WallPoing")
  8.   end if
  9.   set newLocV to the locV of sprite giPongBallChannel + giBallVV
  10.   if newLocV < giPlayFieldTopBoundary then
  11.     set giBallVV to -giBallVV
  12.     puppetSound("WallPoing")
  13.     set newLocV to newLocV + giBallVV + giBallVV
  14.     if giBallMaxVV > giBallVV then
  15.       set giBallVV to giBallVV + 1
  16.     end if
  17.   else
  18.     if newLocV > giPlayFieldBottomBoundary then
  19.       if giPongEasyMode = 0 then
  20.         puppetSound("Sploosh")
  21.         updateStage()
  22.         set x to the timer
  23.         repeat while the timer < (x + 60)
  24.           nothing()
  25.         end repeat
  26.         pongNewBall()
  27.         exit
  28.       else
  29.         set giBallVV to -giBallVV
  30.         set newLocV to newLocV + giBallVV + giBallVV
  31.         puppetSound("WallPoing")
  32.       end if
  33.     end if
  34.   end if
  35.   set the locH of sprite giPongBallChannel to newLocH
  36.   set the locV of sprite giPongBallChannel to newLocV
  37.   updateStage()
  38.   repeat with count = 1 to count(glWallChannels)
  39.     if sprite giPongBallChannel intersects getAt(glWallChannels, count) then
  40.       set liColumnNumber to integer(((newLocH - giPlayFieldLeftBoundary) / giBrickHOffset) + 1)
  41.       if liColumnNumber > 12 then
  42.         set liColumnNumber to 12
  43.       end if
  44.       set llBrickRow to getAt(glBrickList, count)
  45.       if getAt(llBrickRow, liColumnNumber) then
  46.         if not giPongStraightThru then
  47.           set giBallVV to -giBallVV
  48.           set newLocV to newLocV + giBallVV + giBallVV
  49.         end if
  50.         set giPongScore to giPongScore + 60 - (10 * count)
  51.         set liTempH to giPlayFieldLeftBoundary + ((liColumnNumber - 1) * giBrickHOffset) + 10
  52.         set the locH of sprite giPongBrickChannel to liTempH
  53.         set liTempV to giPlayFieldTopBoundary + ((count - 1) * giBrickVOffset) + 10
  54.         set the locV of sprite giPongBrickChannel to liTempV
  55.         updateStage()
  56.         set the locV of sprite giPongBrickChannel to giHideOffset
  57.         updateScore(count)
  58.         setAt(llBrickRow, liColumnNumber, 0)
  59.       end if
  60.     end if
  61.   end repeat
  62.   if sprite giPongPaddleChannel intersects giPongBallChannel then
  63.     set liPaddleLocH to the locH of sprite giPongPaddleChannel
  64.     set liPongBallLocH to the locH of sprite giPongBallChannel
  65.     if liPongBallLocH > (giPaddleQuarterWidth + liPaddleLocH) then
  66.       if liPongBallLocH < (liPaddleLocH + giPaddleHalfWidth) then
  67.       else
  68.         set giBallVH to giBallVH + giPaddleBounceAngle
  69.       end if
  70.     else
  71.       set giBallVH to giBallVH - giPaddleBounceAngle
  72.     end if
  73.     set newLocH to the locH of sprite giPongBallChannel + giBallVH
  74.     set giBallVV to -giBallVV
  75.     set newLocV to the locV of sprite giPongBallChannel + giBallVV
  76.     set the locH of sprite giPongBallChannel to newLocH
  77.     set the locV of sprite giPongBallChannel to newLocV
  78.     soundPaddleHit()
  79.   end if
  80. end
  81.