home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
cnbalex.dir
/
00143_Script_GameHandlers
< prev
next >
Wrap
Text File
|
1996-06-10
|
4KB
|
133 lines
on initGame
global buttonList,paintingList,matchedPaintings,oldValue,disabledButtons
set buttonList = [Circle:17,Triangle:18,Balanced:19,Unbalanced:20]
set paintingList = [pBalanced:11,pCircle:12,pTriangle:13,pUnbalanced:14]
set matchedPaintings = []
set disabledButtons = []
set oldValue = ""
setPuppets buttonlist,TRUE
setPuppets paintingList, TRUE
end
on checkButton aButtonSprite,correctPainting
global disabledButtons,buttonSprite
set buttonSprite = aButtonSprite
if NOT inList (disabledButtons,aButtonSprite) then
processButton aButtonSprite,correctPainting
end if
end
on processButton buttonSprite,correctPainting
global buttonList,paintingList,disabledButtons
-- change te empty castMember of sprite aButton to the shape castMember
set aShape = string(getOne(buttonList,buttonSprite))
set the castNum of sprite buttonSprite to the number of cast aShape
updateStage
-- Sprite's going to be moved so remember the starting location
set oldLocH = the locH of sprite buttonSprite
set oldLocV = the locV of sprite buttonSprite
set oldButtonPos = [oldLocH,oldLocV]
-- Track sprite
repeat while the stillDown
set the locH of sprite buttonSprite to the mouseH
set the locV of sprite buttonSprite to the mouseV
updateStage
end repeat
-- find out which painting this shape is supposed to go to
set correctPaintingSprite = getAprop(paintingList,correctPainting)
-- perform the corresponding action when the shape is on the CORRECT painting...
if sprite buttonSprite WITHIN correctPaintingSprite then
correctPChoice buttonSprite,correctPainting
add(disabledButtons,buttonSprite) -- remember this shape is used so dont use it again
else resetSprite buttonSprite,oldButtonPos
end
-- play animation that shows the shape "growing" on the painting
on correctPChoice bSprite
global buttonList
-- get the property that corresponds to the spriteNumber
set paintingMarker = getOne(buttonList,bSprite)
put "paintingMarker= "&paintingMarker
go to string(paintingMarker)
end
-- bring button back to original state
on resetSprite bSprite,oldLoc
go "Missed"
set the locH of sprite bSprite to getAt(oldLoc,1)
set the locV of sprite bSprite to getAt(oldLoc,2)
--set the castNum of sprite bSprite to the number of cast 23 -- an empty square
updateStage
end
-- handler showMarkedPainting gets called whenever the pb head jumps back to frame
-- "start" after an anomation.It sets all sprites (containing paintings) in mPaintingsList
-- to show their "matched" counterpart - i.e. te one with the shape on it
on showMarkedPainting mPaintingsList
global paintingList,oldValue
if mPaintingsList <> [] then
--if getAt(mPaintingsList,count(mPaintingsList)) <> oldValue then
repeat with i = 1 to count(mPaintingsList)
set the castNum of sprite getAProp(paintingList,getAt(mPaintingsList,i)) ¼
to cast (getAt(mPaintingsList,i)&" On 3")
end repeat
end if
updateStage
end
on grayOutButton
global buttonList,disabledButtons,buttonList
repeat with i = 1 to count(disabledButtons)
set disabledButton = getAt(disabledButtons,i)
set buttonName = getOne(buttonList,disabledButton)
set the castNum of sprite disabledButton to the number of cast (buttonName&"Button Inactive")
set the cursor of sprite disabledButton to -1
end repeat
updateStage
end
-- handler returnToStart shows the first frame and calls handle
-- to gray the chosenbutton
on returnToStart aPainting
global matchedPaintings,buttonSprite
if NOT voidp(aPainting) then add(matchedPaintings,aPainting)
go "Bal4ExST"
grayOutButton buttonSprite
end
on goFrame aFrame
-- test if parameter is valid..
set validFrame = TRUE
if voidP(aFrame) OR aFrame = "" then set validFrame = FALSE
if validFrame then go frame aframe
end