home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Today - The Disc! 22
/
cdrt22.iso
/
pc
/
bugbook
/
puzzle.dir
/
00083_Script_movie2
< prev
next >
Wrap
Text File
|
1995-06-26
|
16KB
|
509 lines
------------------------------------------------------------------------
-- CODE FOR TIMEOUT SCRIPT
------------------------------------------------------------------------
on doTimeOut
global localDir
go "start" of movie localDir&"BugDemo.dir"
end doTimeOut
------------------------------------------------------------------------
------------------------------------------------------------------------
-- CODE FOR ANSON TALKING
------------------------------------------------------------------------
on ansonAction
------------------------------------------------------------------------
--NOTE: This code assumes that you have put some sounds in soundList
------------------------------------------------------------------------
global ansonNum,ansonMoves,ansonSprite,soundList,soundListNum,ansonTalking
if ansonNum = 0 then
set soundListNum = 1
set ansonNum = 1
-- puppetTempo 22
set the loch of sprite ansonSprite = 101
set the locv of sprite ansonSprite = 459
set the stretch of sprite ansonSprite = FALSE
playAnsonSound(getAt(soundList,soundListNum))
set tmpCast = "An-"&string(getAt(ansonMoves,ansonNum))
set the castNum of sprite ansonSprite = the number of cast tmpCast
-- put "init ",tmpCast
else
if soundBusy(2) then
set ansonNum = ansonNum +1
if ansonNum > (count(ansonMoves)) then set ansonNum = 1
set tmpCast = "An-"&string(getAt(ansonMoves,ansonNum))
set the castNum of sprite ansonSprite = the number of cast tmpCast
-- put "continue ",tmpCast
else
set soundListNum=soundListNum+1
if (soundListNum > (count(soundList))) then
set tmpCast = "An-4"
set the castNum of sprite ansonSprite = the number of cast tmpCast
set ansonNum = 0
set ansonTalking = FALSE
-- put "done ",tmpCast
-- puppetTempo 8
else
playAnsonSound(getAt(soundList,soundListNum))
set tmpCast = "An-4"
set the castNum of sprite ansonSprite = the number of cast tmpCast
-- put "next sound ",tmpCast
end if
end if
end if
updateStage
end ansonAction
on ansonOff
global ansonTalking,ansonNum,ansonSprite
sound stop 1
sound stop 2
set ansonTalking=FALSE
set ansonNum = 0
set the loch of sprite ansonSprite = -100
set the locv of sprite ansonSprite = -100
set tmpCast = "An-4"
-- puppetTempo 8
updateStage
end ansonOff
------------------------------------------------------------------------
-- -- *********************************************************
-- -- Name:playAnsonSound
-- -- Description: plays an aif sound of the drive.
-- -- Example:
-- -- *********************************************************
on playAnsonSound FileNme
global localDir
if the machineType=256 then
sound playFile 2, localDir&"GameSnd\" &FileNme&".aif"
else
sound playFile 2,localDir&"GameSnd:" &FileNme&".aif"
end if
end playAnsonSound
on recreate
global movingPiece,currPuzzle,currPiece,A42Puzzle
set tolerance=8
set movingPiece=45
puppetSprite movingPiece,TRUE
-- set the moveableSprite of sprite movingPiece to TRUE
set currPuzzle=A42Puzzle
set currPiece=1
end recreate
on startGame
global allStartList, foundList
-- puppetSprite 1, TRUE
set start42=[point(320, 219), point(590, 216), point(567, 373), point(612, 373), point(567, 335), point(612, 335), point(567, 297), point(612, 297), point(567, 259), point(612, 259), point(567, 411), point(612, 411), point(567, 175), point(612, 175), point(567, 137), point(612, 137), point(567, 99), point(612, 99), point(567, 61), point(612, 61), point(567, 23), point(612, 23), point(49, 216), point(26, 373), point(71, 373), point(26, 335), point(71, 335), point(26, 297), point(71, 297), point(26, 259), point(71, 259), point(26, 411), point(71, 411), point(26, 175), point(71, 175), point(26, 137), point(71, 137), point(26, 99), point(71, 99), point(26, 61), point(71, 61), point(26, 23), point(71, 23)]
set start20=[point(320, 219), point(606, 28), point(572, 69), point(606, 111), point(572, 153), point(606, 196), point(572, 238), point(606, 281), point(572, 323), point(606, 365), point(572, 408), point(33, 28), point(67, 69), point(33, 111), point(67, 153), point(33, 196), point(67, 238), point(33, 281), point(67, 323), point(33, 365), point(67, 408)]
set allStartList=[start20,start42]
set foundList=[]
end startGame
on ReturnMouseLoc
global movingPiece
set tempPoint=point(the locH of sprite the clickOn, the locV of sprite the clickOn)
return tempPoint
end returntempPoint
----------------------------------------
------PuzzleList =1.puzzlePieceName,2.spriteNo,3.locPoint,4.startPoint,5.startSize,6.found
----------------------------------------
on checkLoc
global currHV,hyp,tolerance,currPuzzle,currPiece,movingPiece,GameAnimation,countPieces,currCount
if not(currPiece>1 and currPiece<44) then ABORT
-- if (getAt(getAt(currPuzzle,currPiece),6)=1) then ABORT
--set currHV=returnMouseLoc()
put the locH of sprite movingPiece into currH
put the locV of sprite movingPiece into currV
put the locH of getAt(getAt(currPuzzle,currPiece),3) into lockH
put the locV of getAt(getAt(currPuzzle,currPiece),3) into lockV
set hyp= sqrt((currH-lockH)*(currH-lockH)+(currV-lockV)*(currV-lockV))
if hyp<=tolerance then
puppetSound "CONNECT"
-- --can opt to it this way
set the locV of sprite currPiece=the locV of getAt(getAt(currPuzzle,currPiece),3)
set the locH of sprite currPiece=the locH of getAt(getAt(currPuzzle,currPiece),3)
set the stretch of sprite currPiece to FALSE
-- -- puppetSprite currPiece,FALSE
set the locV of sprite movingPiece=463
set the locH of sprite movingPiece=102
set the castNum of sprite movingPiece=the number of cast "puzzlePart"
set the stretch of sprite movingPiece to FALSE
set currCount=currCount+1
--put (getAT(currPuzzle,currPiece))
setAt(getAt(currPuzzle,currPiece),6,1)
updateStage
else
if currH>600 or currV<-18 then
-- puppetSound "flyback.aif"
if currH>600 and currV>=-18 then
set the locH of sprite movingPiece to 565
else if currH<=600 and currV<-18 then
set the locV of sprite movingPiece to 65
else
set the locH of sprite movingPiece to 565
set the locV of sprite movingPiece to 65
end if
end if
if currH>600 or currV>465 then
-- puppetSound "flyback.aif"
if currH>600 and currV<=465 then
set the locH of sprite movingPiece to 565
else if currH<600 and currV>465 then
set the locV of sprite movingPiece to 373
else
set the locH of sprite movingPiece to 565
set the locV of sprite movingPiece to 373
end if
end if
if currH<-18 or currV<-18 then
-- puppetSound "flyback.aif"
if currH<-18 and currV>=-18 then
set the locH of sprite movingPiece to 65
else if currH>=-18 and currV<-18 then
set the locV of sprite movingPiece to 65
else
set the locH of sprite movingPiece to 65
set the locV of sprite movingPiece to 65
end if
end if
if currH<-18 or currV>465 then
-- puppetSound "flyback.aif"
if currH<-18 and currV<=465 then
set the locH of sprite movingPiece to 65
else if currH>=-18 and currV>465 then
set the locV of sprite movingPiece to 373
else
set the locH of sprite movingPiece to 65
set the locV of sprite movingPiece to 373
end if
end if
updateStage
end if
if currCount=countPieces then
repeat with tempspriteNum = 2 to 43
set the puppet of sprite (tempspriteNum) to FALSE
end repeat
puppetSprite movingPiece,FALSE
set the mouseUpScript=""
go (GameAnimation&".Animation")
puppetSound "forward.aif"
end if
end checkLoc
------------------------------------------------------------------------
-- CODE FOR DEPRESSED BACK BUTTON & SOUND
------------------------------------------------------------------------
on DepressedButtonDown NeedbuttonName,NeedSpriteNum,NeedSound
sound stop 1
puppetSound NeedSound
puppetSprite NeedSpriteNum,TRUE
set the castNum of sprite NeedSpriteNum = the number of cast NeedbuttonName
updateStage
startTimer
repeat while soundBusy(1)
nothing
end repeat
puppetSound 0
puppetSprite NeedSpriteNum,FALSE
updateStage
end DepressedButtonDown
------------------------------------------------------------------------
----------------------------------------
------PuzzleList =1.puzzlePieceName,2.spriteNo,3.locPoint,4.startPoint,5.startSize,6.found
----------------------------------------
on createPiece tempSprite
global currPuzzle,currPiece, movingPiece,currPuzzle,tempPiece
put tempSprite into tempPiece
put the mouseH into currMouseH
put the mouseV into currMouseV
if not(tempPiece=currPiece) then
if sprite 45 within 44 then
puppetSound "flyback.aif"
updateStage
end if
set the castNum of sprite movingPiece to cast getAt(getAt(currPuzzle,tempPiece),1)
set the stretch of sprite movingPiece to FALSE
set the locV of sprite movingPiece=the locV of getAt(getAt(currPuzzle,tempPiece),4)
set the locH of sprite movingPiece=the locH of getAt(getAt(currPuzzle,tempPiece),4)
set the locV of sprite tempPiece=-100
set the locH of sprite tempPiece=-100
updateStage
repeat while soundBusy(1)
nothing
end repeat
if currPiece>1 and not(getAt(getAt(currPuzzle,currPiece),6)=1) then
set the locV of sprite currPiece=the locV of getAt(getAt(currPuzzle,currPiece),4)
set the locH of sprite currPiece= the locH of getAt(getAt(currPuzzle,currPiece),4)
end if
put tempPiece into currPiece
puppetSound "mouse.aif"
updateStage
set deltaH=(currMouseH-the loch of getAt(getAt(currPuzzle,currPiece),4))
set deltav=(currMouseV-the locv of getAt(getAt(currPuzzle,currPiece),4))
-- --move sprite
repeat while the stillDown
set currH=the mouseh-deltah
set currV=the mousev-deltav
set the loch of sprite movingPiece=currh
set the locv of sprite movingPiece=currv
updateStage
end repeat
end if
end createPuzzlePiece
on createNewGame
global foundList,currStart, currPuzzle, countPieces
deleteAt currStart,1
repeat with x=2 to countPieces+1
if x = 1 then nothing
set tempStart=random(count(currStart))
setAt getAt(currPuzzle, x),4,getAt(currStart,tempstart)
puppetSprite (x),TRUE
set the locV of sprite x to the locV of getAt(currStart,tempstart)
set the locH of sprite x to the locH of getAt(currStart,tempstart)
set the stretch of sprite x to TRUE
set the width of sprite x to the locH of getAt(getAt(currPuzzle,x),5)
set the height of sprite x to the locV of getAt(getAt(currPuzzle,x),5)
deleteAt currStart,tempStart
end repeat
updateStage
end createNewGame
------------------------------------------------------------------------
-- CODE FOR ? BUTTONS & SOUND
------------------------------------------------------------------------
on questionDown
global downSprite
sound stop 1
puppetSound "help"
set the castNum of sprite downSprite = the number of cast "?Down"
set the loch of sprite downSprite = 20
set the locv of sprite downSprite = 459
set the stretch of sprite downSprite = FALSE
updateStage
repeat while soundBusy(1)
--
end repeat
puppetSound 0
set the loch of sprite downSprite = -100
set the locv of sprite downSprite = -100
updateStage
end questionDown
------------------------------------------------------------------------
-- CODE FOR DEPRESSED BACK BUTTON & SOUND
------------------------------------------------------------------------
on backDown
global downSprite
sound stop 1
puppetSound "back"
puppetSprite downSprite,TRUE
set the castNum of sprite downSprite = the number of cast "returnDown"
set the loch of sprite downSprite = 619
set the locv of sprite downSprite = 459
set the stretch of sprite downSprite to FALSE
updateStage
repeat while soundBusy(1)
nothing
end repeat
puppetSound 0
set the loch of sprite downSprite = -100
set the locv of sprite downSprite = -100
updateStage
end backDown
on puzzleDown
global downSprite
sound stop 1
sound stop 2
puppetSound "fun2"
puppetSprite downSprite,TRUE
set the castNum of sprite downSprite = the number of cast "hintdown"
set the loch of sprite downSprite = 555
set the locv of sprite downSprite = 462
set the stretch of sprite downSprite to FALSE
updateStage
repeat while soundBusy(1)
nothing
end repeat
puppetSound 0
set the loch of sprite downSprite = -100
set the locv of sprite downSprite = -100
updateStage
end puzzleDown
-- -- *********************************************************
-- -- this is only temp to create all the lists neccessary
-- -- *********************************************************
----------------------------------------
------get the location of the sprite(startLoc,FinishLoc)
----------------------------------------
on createPuzzleInfo currAmount
set tempList=[]
repeat with x=1 to currAmount
add tempList,point(the locH of sprite x, the locV of sprite x)
end repeat
Return tempList
end createPuzzleList
----------------------------------------
------get the size of small piece
----------------------------------------
on createsizeList currAmount
set tempList=[]
repeat with x=1 to currAmount
add tempList,point(the width of sprite x,the height of sprite x)
end repeat
Return tempList
end createPuzzleList
----------------------------------------
------create a name list of the castMembers of the puzzle
----------------------------------------
on createNameList currAmount
set tempList=[]
repeat with x=1 to currAmount
put the castNum of sprite x into tempNum
add tempList,the name of cast tempNum
end repeat
Return tempList
end createPuzzleList
----------------------------------------
------PuzzleList =puzzlePieceName,spriteNo,locPoint,startPoint,startSize,found
----------------------------------------
on createPuzzleList
global locPoint,startSize,nameList
set temppuzzleList=[]
add temppuzzleList,["castName:string","spriteNumber:integer","LockedLocation:point","startPoint:point","startSize:point","found:boolean"]
repeat with x=2 to count(locPoint)
set tempList=[]
add tempList,GetAt(nameList,x)
add tempList,x
add tempList, getAT(locPoint,x)
add tempList, 0
add tempList, getAt(startSize,x)
add tempList,0
add temppuzzleList,tempList
end repeat
return temppuzzleList
end puzzleList
------------------------------------------------------------------------
-- CODE FOR DEPRESSED BUTTON & SOUND
------------------------------------------------------------------------
on DepressedButton NeedbuttonName,NeedSpriteNum,NeedSound
sound stop 1
puppetSound NeedSound
puppetSprite NeedSpriteNum,TRUE
set the castNum of sprite NeedSpriteNum = the number of cast NeedbuttonName
PuppetSoundStop()
puppetSprite NeedSpriteNum,FALSE
updateStage
end backDown
------------------------------------------------------------------------
on PuppetSoundStop
updateStage
repeat while soundBusy(1)
--
end repeat
puppetSound 0
end puppetSoundStop