home *** CD-ROM | disk | FTP | other *** search
- on pongCheckForHit piChannel
- global giPlayFieldLeftBoundary, giPlayFieldTopBoundary, glWallChannels, giPongBrickChannel, glBrickList, giBrickHOffset, giBrickVOffset, giBrickHGrout, giBrickVGrout, giColumns
- set lpHitData to [#locH: 0, #locV: 0, #level: 0]
- set liCalcH to 0
- set liCalcV to 0
- repeat with counter = 1 to count(glWallChannels)
- if sprite piChannel intersects getAt(glWallChannels, counter) then
- set piH to the locH of sprite piChannel
- set liColumnNumber to integer(((piH - giPlayFieldLeftBoundary) / giBrickHOffset) + 0.5)
- if liColumnNumber > giColumns then
- set liColumnNumber to giColumns
- end if
- set llBrickRow to getAt(glBrickList, counter)
- if getAt(llBrickRow, liColumnNumber) > 0 then
- set liCalcH to giPlayFieldLeftBoundary + ((liColumnNumber - 1) * giBrickHOffset) + giBrickHGrout
- set liCalcV to the locV of sprite getAt(glWallChannels, counter) + giBrickVGrout
- set the locH of lpHitData to liCalcH
- set the locV of lpHitData to liCalcV
- set the level of lpHitData to counter
- setAt(llBrickRow, liColumnNumber, 0)
- return lpHitData
- end if
- end if
- end repeat
- return 0
- end
-