home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, pLoc, pSpeed, pMoveH, pMoveV, pFlash, pTemp
- global gLocH, gLocV, myAngle, h, v, gBallSpeed, gBallDirection, gPaddleHits, gPause, gLevel, gPaddle, gGoBall
-
- on beginSprite me
- gLocH = 290
- gLocV = 264
- gPaddle = 0
- pFlash = 1
- gBallSpeed = 4
- gLocH = 290
- gLocV = 264
- sprite(5).locH = 290
- sprite(5).locV = 264
- gBallDirection = 180.0
- gPaddleHits = 0
- sprite(14).visible = 1
- sprite(15).visible = 1
- sprite(16).visible = 1
- sprite(3).visible = 0
- sprite(80).visible = 0
- sprite(82).visible = 1
- sprite(12).visible = 0
- gLevel = 1
- member("Level_display_a").text = "Level:" && string(gLevel)
- member("Level_display_b").text = "Level:" && string(gLevel)
- gScore = 0
- member("Score01").text = "Score:" && string(gScore)
- member("Score02").text = "Score:" && string(gScore)
- cursor(200)
- end
-
- on exitFrame
- if gPause = 0 then
- if (the timer > 195) and (the timer < 203) then
- gGoBall = 1
- sprite(82).visible = 0
- sprite(80).visible = 0
- end if
- if gGoBall = 1 then
- BallFly()
- sprite(80).visible = 0
- if gPaddle = 1 then
- sprite(2).member = "ship_frame " & pFlash
- pTemp = pTemp + 1
- if pTemp > 2 then
- pFlash = pFlash + 1
- pTemp = 1
- end if
- if pFlash >= 5 then
- pFlash = 1
- gPaddle = 0
- end if
- end if
- else
- if the timer > 203 then
- gamePaused()
- end if
- end if
- end if
- end
-
- on BallFly me
- pMyAngle = gBallDirection * PI / 180.0
- h = sin(pMyAngle) * gBallSpeed
- v = -cos(pMyAngle) * gBallSpeed
- gLocH = gLocH + h
- gLocV = gLocV + v
- sprite(4).loc = point(gLocH, gLocV)
- updateStage()
- wallBounce()
- paddleBounce()
- sprite(spriteNum).loc = point(gLocH, gLocV)
- end
-
- on wallBounce me
- if sprite(4).intersects(9) then
- puppetSound(2, "hitwall")
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 270 - gBallDirection + 90
- end if
- if sprite(4).intersects(8) then
- puppetSound(2, "hitwall")
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 90 - gBallDirection + 270
- end if
- if sprite(4).locV < 9 then
- puppetSound(2, "hitwall")
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 180 - gBallDirection + 360
- end if
- if gBallDirection > 360 then
- gBallDirection = gBallDirection - 360
- else
- if gBallDirection < 0 then
- gBallDirection = gBallDirection + 360
- end if
- end if
- end
-
- on paddleBounce me
- if ((sprite(spriteNum).locV + 8) < 390) and ((sprite(spriteNum).locV + 8) > 300) then
- if sprite(2).intersects(4) then
- gPaddle = 1
- puppetSound(2, "hit paddle")
- gPaddleHits = gPaddleHits + 1
- if gBallSpeed <= 16 then
- if gPaddleHits = 1 then
- gBallSpeed = 7
- end if
- if (gPaddleHits mod 4) = 0 then
- gBallSpeed = gBallSpeed + 1
- end if
- end if
- if (sprite(4).locH <= sprite(2).locH) and (sprite(4).locH > (sprite(2).locH - 6)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 355 - random(10)
- end if
- if (sprite(4).locH <= (sprite(2).locH - 6)) and (sprite(4).locH > (sprite(2).locH - 12)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 345 - random(10)
- end if
- if (sprite(4).locH <= (sprite(2).locH - 12)) and (sprite(4).locH > (sprite(2).locH - 18)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 335 - random(10)
- end if
- if (sprite(4).locH <= (sprite(2).locH - 18)) and (sprite(4).locH > (sprite(2).locH - 24)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 325 - random(10)
- end if
- if (sprite(4).locH <= (sprite(2).locH - 24)) and (sprite(4).locH > (sprite(2).locH - 30)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 315 - random(10)
- end if
- if sprite(4).locH <= (sprite(2).locH - 30) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 305 - random(10)
- end if
- if (sprite(4).locH >= sprite(2).locH) and (sprite(4).locH < (sprite(2).locH + 6)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 5 + random(10)
- end if
- if (sprite(4).locH >= (sprite(2).locH + 6)) and (sprite(4).locH < (sprite(2).locH + 12)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 15 + random(10)
- end if
- if (sprite(4).locH >= (sprite(2).locH + 12)) and (sprite(4).locH < (sprite(2).locH + 18)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 25 + random(10)
- end if
- if (sprite(4).locH >= (sprite(2).locH + 18)) and (sprite(4).locH < (sprite(2).locH + 24)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 35 + random(10)
- end if
- if (sprite(4).locH >= (sprite(2).locH + 24)) and (sprite(4).locH < (sprite(2).locH + 30)) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 45 + random(10)
- end if
- if sprite(4).locH >= (sprite(2).locH + 30) then
- gLocH = gLocH - h
- gLocV = gLocV - v
- gBallDirection = 55 + random(10)
- end if
- end if
- else
- if sprite(spriteNum).locV > 448 then
- sprite(80).play()
- loseALife()
- end if
- end if
- if gBallDirection > 360 then
- gBallDirection = gBallDirection - 360
- else
- if gBallDirection < 0 then
- gBallDirection = gBallDirection + 360
- end if
- end if
- end
-
- on gamePaused me
- if (sprite(16).visible = 1) and (sprite(12).visible = 0) then
- sprite(80).visible = 1
- if keyPressed(SPACE) or the mouseDown then
- sprite(80).rewind()
- sprite(80).visible = 0
- gPause = 0
- gGoBall = 1
- end if
- end if
- end
-