home *** CD-ROM | disk | FTP | other *** search
- global gBlockArray, gPeiceSelected, gPeiceX, gPeiceY, gLaserList, gOtherPeiceSelected, gLevelNum, gStupidCounter
-
- on doMouseInput
- checkMouseUp()
- checkMouseDown()
- checkMouseMove()
- end
-
- on checkMouseUp
- if (the mouseUp = 1) and (gOtherPeiceSelected = 1) then
- if gBlockArray[gPeiceY][gPeiceX].getObjectType() = 1 then
- gOtherPeiceSelected = 0
- gBlockArray[gPeiceY][gPeiceX].rotateObject()
- repeat with a = 1 to count(gLaserList)
- gLaserList[a].updateLaser()
- end repeat
- exit
- end if
- end if
- if (the mouseUp = 1) and (gPeiceSelected = 1) then
- gPeiceSelected = 0
- gBlockArray[gPeiceY][gPeiceX].dropBlock()
- if ((((gBlockArray[gPeiceY][gPeiceX].getBlockPosY() - 25) / 50) + 1) = gPeiceY) and ((((gBlockArray[gPeiceY][gPeiceX].getBlockPosX() - 20) / 50) + 1) = gPeiceX) then
- gBlockArray[gPeiceY][gPeiceX].rotateObject()
- else
- col = ((gBlockArray[gPeiceY][gPeiceX].getBlockPosY() - 25) / 50) + 1
- row = ((gBlockArray[gPeiceY][gPeiceX].getBlockPosX() - 20) / 50) + 1
- gBlockArray[((gBlockArray[gPeiceY][gPeiceX].getBlockPosY() - 25) / 50) + 1][((gBlockArray[gPeiceY][gPeiceX].getBlockPosX() - 20) / 50) + 1] = gBlockArray[gPeiceY][gPeiceX]
- gBlockArray[gPeiceY][gPeiceX] = 0
- if gBlockArray[col][row].getObjectType() = 7 then
- gLaserList[gBlockArray[col][row].getLaserReference()].setDirection(gBlockArray[col][row].getOjectDirection())
- gLaserList[gBlockArray[col][row].getLaserReference()].setCoordinates(col, row)
- end if
- end if
- setAllBlocksUnlit()
- repeat with a = 1 to count(gLaserList)
- gLaserList[a].updateLaser()
- end repeat
- if checkMissionObjectives() = 1 then
- if gLevelNum = 5 then
- puppetSound(4, "win")
- go(19)
- else
- puppetSound(4, "levelcomplete10")
- go(34)
- end if
- end if
- end if
- gOtherPeiceSelected = 0
- end
-
- on checkMouseDown
- if gOtherPeiceSelected = 1 then
- exit
- end if
- if (the mouseDown = 1) and (gPeiceSelected = 0) then
- mouseX = mouseH()
- mouseY = mouseV()
- if (mouseX < 20) or (mouseX > 425) or (mouseY < 25) or (mouseY > 420) then
- exit
- end if
- gPeiceX = ((mouseX - 20) / 50) + 1
- gPeiceY = ((mouseY - 25) / 50) + 1
- if (gPeiceX < 1) or (gPeiceX > 8) then
- exit
- end if
- if (gPeiceY < 1) or (gPeiceY > 8) then
- exit
- end if
- if gBlockArray[gPeiceY][gPeiceX] = 0 then
- gPeiceSelected = 0
- else
- if gBlockArray[gPeiceY][gPeiceX].getObjMovable() = 1 then
- puppetSound(1, "pick up block")
- gPeiceSelected = 1
- else
- gOtherPeiceSelected = 1
- end if
- end if
- end if
- end
-
- on checkMouseMove
- posXLock = 0
- posYLock = 0
- if gOtherPeiceSelected = 1 then
- exit
- end if
- if gPeiceSelected = 0 then
- exit
- end if
- selectedX = gBlockArray[gPeiceY][gPeiceX].getBlockPosX()
- selectedY = gBlockArray[gPeiceY][gPeiceX].getBlockPosY()
- mouseX = mouseH()
- mouseY = mouseV()
- if selectedX > mouseX then
- if (selectedX - mouseX) > 20 then
- mouseX = selectedX - 20
- end if
- else
- if (mouseX - selectedX) > 20 then
- mouseX = selectedX + 20
- end if
- end if
- if selectedY > mouseY then
- if (selectedY - mouseY) > 20 then
- mouseY = selectedY - 20
- end if
- else
- if (mouseY - selectedY) > 20 then
- mouseY = selectedY + 20
- end if
- end if
- sprite(9).loc = point(mouseX, gBlockArray[gPeiceY][gPeiceX].getBlockPosY())
- sprite(10).loc = point(gBlockArray[gPeiceY][gPeiceX].getBlockPosX(), mouseY)
- updateStage()
- counter = 51
- repeat with y = 1 to 8
- repeat with x = 1 to 8
- if sprite(gBlockArray[gPeiceY][gPeiceX].getChannel()).intersects(counter) then
- if gBlockArray[gPeiceY][gPeiceX].getChannel() <> counter then
- gStupidCounter = gStupidCounter + 1
- end if
- end if
- if (sprite(9).intersects(counter) = 1) or (sprite(10).intersects(counter) = 1) then
- if not ((x = gPeiceY) and (y = gPeiceX)) then
- colidedX = sprite(counter).locH
- colidedY = sprite(counter).locV
- if (selectedY > (colidedY + 48)) and (selectedX > (colidedX - 48)) and (selectedX < (colidedX + 48)) then
- mouseY = colidedY + 50
- else
- if (selectedY < (colidedY - 48)) and (selectedX > (colidedX - 48)) and (selectedX < (colidedX + 48)) then
- mouseY = colidedY - 50
- else
- if (selectedY > (colidedY - 48)) and (selectedY < (colidedY + 48)) and (selectedX > (colidedX + 48)) then
- mouseX = colidedX + 50
- else
- if (selectedY > (colidedY - 48)) and (selectedY < (colidedY + 48)) and (selectedX < (colidedX - 48)) then
- mouseX = colidedX - 50
- end if
- end if
- end if
- end if
- end if
- end if
- counter = counter + 1
- end repeat
- end repeat
- sprite(11).loc = point(mouseX, mouseY)
- updateStage()
- bool = 1
- counter = 51
- repeat with y = 1 to 8
- repeat with x = 1 to 8
- if not (gBlockArray[gPeiceY][gPeiceX].getChannel() = counter) then
- if sprite(11).intersects(counter) = 1 then
- bool = 0
- end if
- end if
- counter = counter + 1
- end repeat
- end repeat
- if gPeiceSelected = 1 then
- if bool = 1 then
- gBlockArray[gPeiceY][gPeiceX].setBlockPosition(mouseX, mouseY)
- end if
- end if
- end
-
- on setAllBlocksUnlit
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- gBlockArray[x][y].unlitObject()
- gBlockArray[x][y].setBlueFalse()
- gBlockArray[x][y].setGreenFalse()
- gBlockArray[x][y].setRedFalse()
- end if
- end repeat
- end repeat
- end
-
- on checkMissionObjectives
- bool = 0
- case gLevelNum of
- 1:
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- if gBlockArray[x][y].getObjectType() = 8 then
- if gBlockArray[x][y].pObjLit = 1 then
- bool = 1
- end if
- end if
- end if
- end repeat
- end repeat
- 2:
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- if gBlockArray[x][y].getObjectType() = 8 then
- if gBlockArray[x][y].pObjLit = 1 then
- bool = 1
- end if
- end if
- end if
- end repeat
- end repeat
- 3:
- counter = 0
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- if gBlockArray[x][y].getObjectType() = 8 then
- if gBlockArray[x][y].pObjLit = 1 then
- counter = counter + 1
- end if
- end if
- end if
- end repeat
- end repeat
- if counter >= 3 then
- bool = 1
- end if
- 4:
- counter = 0
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- if gBlockArray[x][y].getObjectType() = 3 then
- if gBlockArray[x][y].pObjLit = 1 then
- counter = counter + 1
- end if
- end if
- end if
- end repeat
- end repeat
- if counter >= 4 then
- bool = 1
- end if
- 5:
- counter = 0
- repeat with x = 1 to 8
- repeat with y = 1 to 8
- if not (gBlockArray[x][y] = 0) then
- if gBlockArray[x][y].getObjectType() = 3 then
- if gBlockArray[x][y].pObjLit = 1 then
- counter = counter + 1
- end if
- end if
- end if
- end repeat
- end repeat
- if counter >= 3 then
- bool = 1
- end if
- end case
- return bool
- end
-