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

  1. on pongCheckForHit piChannel
  2.   global giPlayFieldLeftBoundary, giPlayFieldTopBoundary, glWallChannels, giPongBrickChannel, glBrickList, giBrickHOffset, giBrickVOffset, giBrickHGrout, giBrickVGrout, giColumns
  3.   set lpHitData to [#locH: 0, #locV: 0, #level: 0]
  4.   set liCalcH to 0
  5.   set liCalcV to 0
  6.   repeat with counter = 1 to count(glWallChannels)
  7.     if sprite piChannel intersects getAt(glWallChannels, counter) then
  8.       set piH to the locH of sprite piChannel
  9.       set liColumnNumber to integer(((piH - giPlayFieldLeftBoundary) / giBrickHOffset) + 0.5)
  10.       if liColumnNumber > giColumns then
  11.         set liColumnNumber to giColumns
  12.       end if
  13.       set llBrickRow to getAt(glBrickList, counter)
  14.       if getAt(llBrickRow, liColumnNumber) > 0 then
  15.         set liCalcH to giPlayFieldLeftBoundary + ((liColumnNumber - 1) * giBrickHOffset) + giBrickHGrout
  16.         set liCalcV to the locV of sprite getAt(glWallChannels, counter) + giBrickVGrout
  17.         set the locH of lpHitData to liCalcH
  18.         set the locV of lpHitData to liCalcV
  19.         set the level of lpHitData to counter
  20.         setAt(llBrickRow, liColumnNumber, 0)
  21.         return lpHitData
  22.       end if
  23.     end if
  24.   end repeat
  25.   return 0
  26. end
  27.