home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 127 / dpcs0998.iso / Internet / netobs / Install.exe / t2.z / BREAKOUT.DCR / 00008_ballScript.ls < prev    next >
Encoding:
Text File  |  1998-01-20  |  4.4 KB  |  114 lines

  1. property iiVH, iiVV, iiMaxVH, iiMaxVV, iiChannel, iiCastName
  2.  
  3. on birth me, piVH, piVV, piMaxVH, piMaxVV, piChannel, psCastName
  4.   set the iiVH of me to piVH
  5.   set the iiVV of me to piVV
  6.   set the iiMaxVH of me to piMaxVH
  7.   set the iiMaxVV of me to piMaxVV
  8.   set the iiChannel of me to piChannel
  9.   set the iiCastName of me to psCastName
  10.   puppetSprite(the iiChannel of me, 1)
  11.   if the depth of cast psCastName = 1 then
  12.     set the foreColor of sprite the iiChannel of me to 5
  13.   end if
  14.   set the castNum of sprite the iiChannel of me to the number of member psCastName
  15.   set the locH of sprite the iiChannel of me to 320
  16.   set the locV of sprite the iiChannel of me to 140
  17.   if the visible of sprite the iiChannel of me = 0 then
  18.     set the visible of sprite the iiChannel of me to 1
  19.   end if
  20.   debugMessage("birthed")
  21.   return me
  22. end
  23.  
  24. on mPongBallReset me
  25.   set the locH of sprite the iiChannel of me to integer((the stageRight - the stageLeft) / 2)
  26.   set the locV of sprite the iiChannel of me to 80
  27.   set the iiVV of me to integer(the iiVV of me / 2)
  28.   if (the iiVV of me < 5) and (the iiVV of me > -5) then
  29.     set the iiVV of me to 5
  30.   end if
  31. end
  32.  
  33. on mPongBallMove me
  34.   global giPongPaddleChannel, giPongBrickChannel, giPaddleBounceAngle, giPongEasyMode, giPlayFieldLeftBoundary, giPlayFieldRightBoundary, giPlayFieldTopBoundary, giPlayFieldBottomBoundary, giPongScore, giBrickVOffset, giBrickHOffset, glWallChannels, glBrickList, giHideOffset, giPaddleHalfWidth, giPaddleQuarterWidth, giPongStraightThru, giBallMinTicks, giHitsOnDelay, giPongSplashChannel, gbPaused
  35.   set liStartingTicks to the ticks
  36.   set tempChannel to the iiChannel of me
  37.   set newLocH to the locH of sprite tempChannel + the iiVH of me
  38.   if (newLocH > giPlayFieldRightBoundary) or (newLocH < giPlayFieldLeftBoundary) then
  39.     set the iiVH of me to -(the iiVH of me)
  40.     set newLocH to newLocH + the iiVH of me + the iiVH of me
  41.     puppetSound("WallPoing")
  42.   end if
  43.   set newLocV to the locV of sprite the iiChannel of me + the iiVV of me
  44.   if newLocV < giPlayFieldTopBoundary then
  45.     set the iiVV of me to -(the iiVV of me)
  46.     puppetSound("WallPoing")
  47.     set newLocV to newLocV + the iiVV of me + the iiVV of me
  48.     if the iiMaxVV of me > the iiVV of me then
  49.       set the iiVV of me to the iiVV of me + 1
  50.     end if
  51.   else
  52.     if newLocV > giPlayFieldBottomBoundary then
  53.       if giPongEasyMode = 0 then
  54.         puppetSound("Sploosh")
  55.         set the locH of sprite giPongSplashChannel to newLocH
  56.         updateStage()
  57.         set x to the timer
  58.         repeat while the timer < (x + 60)
  59.           nothing()
  60.         end repeat
  61.         pongNewBall()
  62.         if gbPaused = 0 then
  63.           mPongBallReset(me)
  64.         end if
  65.         exit
  66.       else
  67.         set the iiVV of me to -(the iiVV of me)
  68.         set newLocV to newLocV + the iiVV of me + the iiVV of me
  69.         puppetSound("WallPoing")
  70.       end if
  71.     end if
  72.   end if
  73.   set the locH of sprite the iiChannel of me to newLocH
  74.   set the locV of sprite the iiChannel of me to newLocV
  75.   updateStage()
  76.   set lTemp to pongCheckForHit(the iiChannel of me)
  77.   if listp(lTemp) then
  78.     pongProcessHit(lTemp)
  79.     if not giPongStraightThru then
  80.       set the iiVV of me to -(the iiVV of me)
  81.       set newLocV to newLocV + the iiVV of me + the iiVV of me
  82.     end if
  83.   end if
  84.   if sprite giPongPaddleChannel intersects the iiChannel of me then
  85.     set liPaddleLocH to the locH of sprite giPongPaddleChannel
  86.     set liPongBallLocH to the locH of sprite the iiChannel of me
  87.     if liPongBallLocH > (giPaddleQuarterWidth + liPaddleLocH) then
  88.       if liPongBallLocH < (liPaddleLocH + giPaddleHalfWidth) then
  89.       else
  90.         set the iiVH of me to the iiVH of me + giPaddleBounceAngle
  91.       end if
  92.     else
  93.       set the iiVH of me to the iiVH of me - giPaddleBounceAngle
  94.     end if
  95.     if abs(the iiVH of me) > the iiMaxVH of me then
  96.       if the iiVH of me < 0 then
  97.         set the iiVH of me to -(the iiMaxVH of me)
  98.       else
  99.         set the iiVH of me to the iiMaxVH of me
  100.       end if
  101.     end if
  102.     set newLocH to the locH of sprite the iiChannel of me + the iiVH of me
  103.     set the iiVV of me to -(the iiVV of me)
  104.     set newLocV to the locV of sprite the iiChannel of me + the iiVV of me
  105.     set the locH of sprite the iiChannel of me to newLocH
  106.     set the locV of sprite the iiChannel of me to newLocV
  107.     soundPaddleHit()
  108.   end if
  109.   repeat while the ticks < (liStartingTicks + giBallMinTicks)
  110.     set giHitsOnDelay to giHitsOnDelay + 1
  111.     pongPaddleMove()
  112.   end repeat
  113. end
  114.