Code: Select all
global gStartTime
global gBestHumanTime
global gYourTime
global gMiddleButton
global gSuperSwaps
global gBestBotTime
global gBotTime
global gCurrentState
global gHumanCurrentState
global gSpaceButton
global gHumanSpaceButton
global gWidthPadding
global gHeightPadding
global gHumanWidthPadding
global gHumanHeightPadding
global gGroupOffset
#settings for both ipad and iphone
local sTilesX = 3, sTilesY = 3, sWinningState = "1 2 3 4 5 6 7 8 9"
local sInitTime, sEndTime, sHoldTime =300
local sOffset, sWidth, sHeight, sWidthPadding, sHeightPadding, sHumanWidthPadding, sHumanHeightPadding
GroupOffset
on preOpenCard
if the environment is "mobile" then
iphoneStopPlayingOnChannel "Background"
iphoneStopPlayingOnChannel "BackgroundOnce"
end if
put 9 into gSpaceButton
put 9 into gHumanSpaceButton
set movespeed to 65535
if (the machine is "iPad") or \
(the width of this stack is 1024) then
repeat with i = 1 to the number of controls in this card
put 223 into gWidthPadding
put 262 into gHeightPadding
put 583 into gHumanWidthPadding
put 262 into gHumanHeightPadding
put 360 into gGroupOffset
put 5 into sOffset
put 100 into sWidth
put 100 into sHeight
end repeat
end if
if (the machine is "iPhone") or \
(the machine is "iPod Touch") or \
(the width of this stack is 480) or \
(the machine is "iPhone Simulator") then
put 94 into gWidthPadding
put 115 into gHeightPadding
put 274 into gHumanWidthPadding
put 115 into gHumanHeightPadding
put 180 into gGroupOffset
put 5 into sOffset
put 50 into sWidth
put 50 into sHeight
end if
-- repeat with i = 1 to the number of buttons in this card
-- if the name of button i contains "tile" then
-- if the name of button i contains "human" then
-- set the cPlayer of button i to "human"
-- else
-- set the cPlayer of button i to "bot"
-- end if
-- end if
-- end repeat
resetButtons
end preOpenCard
on mouseDown
-- set the moveSpeed to 65535
-- if the cToggle of this card is "numbers" then
-- if the name of the target contains "tile" then
put the millisecs into sInitTime
--end if
--end if
-- if the cToggle of this card is "pictures" then
-- if the name of the target contains "shard" then
-- put the millisecs into sInitTime
-- end if
-- end if
end mouseDown
on mouseUp
-- local tCurrentState, tButtonToSwap
local tButtonToSwap
-- set the moveSpeed to 65535
# minimum hold time in millisecs
put the millisecs into sEndTime
if the name of the target contains "human" then
if the name of the target contains "human shard" then
put character 12 of the short name of the target into tButtonToSwap
end if
if the name of the target contains "human tile" then
put character 11 of the short name of the target into tButtonToSwap
end if
-- put location of button ("human tile" & tButtonToSwap) into tButtonLocation
-- move button ("human tile" & tButtonToSwap) from location of button ("human tile" & tButtonToSwap) to \
-- location of button ("human tile" & gSpaceButton) without messages
-- move button ("human tile" & gSpaceButton) from location of button ("human tile" & gSpaceButton) to \
-- tButtonLocation without messages
-- repeat with i = 1 to 9
-- set the loc of image ("shard" & i & ".png") to the loc of button ("tile" & i)
-- set the loc of image ("human shard" & i & ".png") to the loc of button ("human tile" & i)
-- end repeat
-- if (sEndTime - sInitTime) >= sHoldTime then
-- set the cHeld of the target to "yes"
-- #superswap
-- if gSuperSwaps > 0 then
-- swapButtons gSpaceButton, tButtonToSwap
-- subtract 1 from gSuperSwaps
-- put gSuperSwaps into line 2 of fld "SuperSwaps"
-- end if
-- else
-- set the cHeld of the target to "no"
# swap buttons regularly
if (isSwapable(gSpaceButton, tButtonToSwap) is true) then
swapButtons gSpaceButton, tButtonToSwap
else
if (isDoubleSwapable(gSpaceButton, tButtonToSwap) is true) then
doubleSwapButtons gMiddleButton, gSpaceButton, tButtonToSwap
end if
end if
-- end if
put boardToBoardState (gHumanWidthPadding, gHumanHeightPadding) into tHumanCurrentState
if the cFinishable of this card is "yes" then
if manhattanDistance (tHumanCurrentState) is 0 then
finishHumanPuzzle
end if
end if
end if
end mouseUp
-- if the cToggle of this card is "numbers" then
-- if the name of the target contains "tile" then
-- # minimum hold time in millisecs
-- put the millisecs into sEndTime
-- -- if the name of the target contains "human" then
-- put character 11 of the short name of the target into tButtonToSwap
-- end if
-- if the name of the target contains "human" is false then
-- put character 5 of the short name of the target into tButtonToSwap
-- end if
-- put the name of the target into tButtonToSwap
# check whether the hold was long enough for a superswap
-- if (sEndTime - sInitTime) >= sHoldTime then
-- set the cHeld of the target to "yes"
-- #superswap
-- if gSuperSwaps > 0 then
-- swapButtons gSpaceButton, tButtonToSwap
-- subtract 1 from gSuperSwaps
-- put gSuperSwaps into line 2 of fld "SuperSwaps"
-- end if
-- else
-- set the cHeld of the target to "no"
-- # swap buttons regularly
-- if (isSwapable(gSpaceButton, tButtonToSwap) is true) then
-- swapButtons gSpaceButton, tButtonToSwap
-- else
-- if (isDoubleSwapable(gSpaceButton, tButtonToSwap) is true) then
-- doubleSwapButtons gMiddleButton, gSpaceButton, tButtonToSwap
-- end if
-- end if
-- put boardToBoardState (gHumanWidthPadding, gHumanHeightPadding) into tCurrentState
-- if the cFinishable of this card is "yes" then
-- if manhattanDistance (tCurrentState) is 0 then
-- finishHumanPuzzle
-- end if
-- end if
-- end if
-- end if
--end if
--if the cToggle of this card is "pictures" then
-- if the name of the target contains "shard" then
-- # minimum hold time in millisecs
-- put the millisecs into sEndTime
-- -- if the name of the target contains "human" then
-- -- put character 11 of the short name of the target into tButtonToSwap
-- -- end if
-- -- if the name of the target contains "human" is false then
-- -- put character 5 of the short name of the target into tButtonToSwap
-- -- end if
-- put character 12 of the short name of the target into tButtonToSwap
-- -- put the name of the target into tButtonToSwap
-- # check whether the hold was long enough for a superswap
-- if (sEndTime - sInitTime) >= sHoldTime then
-- set the cHeld of the target to "yes"
-- #superswap
-- if gSuperSwaps > 0 then
-- swapButtons gSpaceButton, tButtonToSwap
-- subtract 1 from gSuperSwaps
-- put gSuperSwaps into line 2 of fld "SuperSwaps"
-- end if
-- else
-- set the cHeld of the target to "no"
-- # swap buttons regularly
-- if (isSwapable(gSpaceButton, tButtonToSwap) is true) then
-- swapButtons gSpaceButton, tButtonToSwap
-- else
-- if (isDoubleSwapable(gSpaceButton, tButtonToSwap) is true) then
-- doubleSwapButtons gMiddleButton, gSpaceButton, tButtonToSwap
-- end if
-- end if
-- end if
-- end if
--end if
--put boardToBoardState (sHumanWidthPadding, sHumanHeightPadding) into gHumanCurrentState
--if the cFinishable of this card is "yes" then
-- if manhattanDistance (gHumanCurrentState) is 0 then
-- finishHumanPuzzle
-- end if
--end if
on stopMessages
repeat for each line aLine in the pendingMessages
if aLine contains "arration" or \
aLine contains "putLine" or \
aLine contains "diamond" or \
aLine contains "Timer" or \
aLine contains "mouse" or \
aLine contains "showMovie" or \
aLine contains "Dialogue" then
cancel item 1 of aLine
end if
end repeat
end stopMessages
on resetButtons
stopMessages
set the backgroundColor of me to 85, 172, 116
repeat with i = 1 to the number of buttons in this card
set the style of button i to "shadow"
set the opaque of button i to false
set the backgroundColor of button i to red
set the textColor of button i to purple
end repeat
repeat with i = 1 to the number of fields in this card
set the textColor of field i to purple
set the opaque of field i to false
if the name of fld i contains "Time" then
set the shadow of field i to true
set the borderwidth of field i to 2
end if
end repeat
set the cShuffleLabel of this card to "shuffle"
-- set the cStopped of this card to "no"
set the cFinishable of this card to "no"
-- set the cToggle of this card to "numbers"
put 0 into line 2 of field "Human Time"
put 0 into line 2 of field "Bot Time"
set the label of button "Shuffle" to "Shuffle"
if gBestHumanTime = 0 then
put empty into line 2 of field "Best Human Time"
end if
if gBestBotTime = 0 then
put empty into line 2 of field "Best Bot Time"
end if
repeat with i = 1 to 9
set the loc of image ("shard" & i & ".png") to the loc of button ("tile" & i)
set the loc of image ("human shard" & i & ".png") to the loc of button ("human tile" & i)
end repeat
-- put 10 into gSuperSwaps
-- put "Superswaps left:" & cr & gSuperSwaps into fld "SuperSwaps"
-- repeat with i = 1 to the number of images in this card
-- if the name of image i contains "shard" then
-- -- hide image i
-- end if
-- end repeat
repeat with i = 1 to 8
set the backgroundColor of btn ("tile" & i) to red
set the backgroundColor of btn ("human tile" & i) to red
show button i
end repeat
hide button "tile9"
hide btn "human tile9"
-- hide image "shard9.png"
-- hide image "human shard9.png"
-- set the width of btn "numbers" to 100
-- set the height of btn "numbers" to 100
-- hide button "numbers"
-- show image "pictures"
repeat with i = 1 to 9
put (item 1 of the loc of btn ("tile" & i)) + gGroupOffset into tHumanTileXCoord
put item 2 of the loc of btn ("tile" & i) into tHumanTileYCoord
set the loc of btn ("human tile" & i) to tHumanTileXCoord, tHumanTileYCoord
set the loc of image ("human shard" & i & ".png") to tHumanTileXCoord, tHumanTileYCoord
end repeat
if (the machine is "iPad") or \
(the width of this stack is 1024) then
set the width of image "pictures" to 80
set the height of image "pictures" to 80
repeat with i = 1 to the number of controls in this card
-- set the cStartRect of control i to the rect of control i
-- set the cStartTextSize of control i to the textSize of control i
-- set the cStartTextHeight of control i to the textHeight of control i
-- set the cStartbackgroundColor of control i to the backgroundColor of control i
set the rect of control i to the cStartRect of control i
set the textSize of control i to the cStartTextSize of control i
set the textHeight of control i to the cStartTextHeight of control i
set the backgroundColor of control i to the cStartbackgroundColor of control i
-- set the width of btn ("human tile" & i) to 100
-- set the height of btn ("human tile" & i) to 100
-- show control i
end repeat
-- set the width of image "pictures" to 80
-- set the height of image "pictures" to 80
-- set the width of btn "numbers" to 80
-- set the height of btn "numbers" to 80
-- set the textHeight of btn "Stop" to 40
-- set the rect of btn "tile1" to 200, 200, 300, 300
-- set the rect of btn "tile2" to 305, 200, 405, 300
-- set the rect of btn "tile3" to 410, 200, 510, 300
-- set the rect of btn "tile4" to 200, 305, 300, 405
-- set the rect of btn "tile5" to 305, 305, 405, 405
-- set the rect of btn "tile6" to 410, 305, 510, 405
-- set the rect of btn "tile7" to 200, 410, 300, 510
-- set the rect of btn "tile8" to 305, 410, 405, 510
-- set the rect of btn "tile9" to 410, 410, 510, 510
end if
if (the machine is "iPhone") or \
(the machine is "iPod Touch") or \
(the width of this stack is 480) or \
(the machine is "iPhone Simulator") then
set the width of image "pictures" to 40
set the height of image "pictures" to 40
set the width of btn "numbers" to 40
set the height of btn "numbers" to 40
repeat with i = 1 to 9
set the width of btn ("human tile" & i) to 50
set the height of btn ("human tile" & i) to 50
set the width of img ("shard" & i & ".png") to 50
set the height of img ("shard" & i & ".png") to 50
set the width of img ("human shard" & i & ".png") to 50
set the height of img ("human shard" & i & ".png") to 50
end repeat
repeat with i = 1 to the number of controls in this card
-- set the cIphoneStartRect of control i to the rect of control i
-- set the cIphoneStartTextSize of control i to the textSize of control i
-- set the cIphoneStartTextHeight of control i to the textHeight of control i
set the rect of control i to the cIphoneStartRect of control i
set the textSize of control i to the cIphoneStartTextSize of control i
set the textHeight of control i to the cIphoneStartTextHeight of control i
-- set the width of btn ("human tile" & i) to 50
-- set the height of btn ("human tile" & i) to 50
end repeat
repeat with n = 1 to the number of fields in this card
set the textSize of fld n to 14
end repeat
repeat with n = 1 to the number of buttons in this card
set the textSize of button n to 30
end repeat
end if
-- repeat with i = 1 to the number of controls in this card
-- if the short name of control i contains "Return" is false then
-- put (item 1 of the cStartRect of control i * (480/1024)) into tIphoneRect1
-- put (item 2 of the cStartRect of control i * (320/768)) into tIphoneRect2
-- put (item 3 of the cStartRect of control i * (480/1024)) into tIphoneRect3
-- put (item 4 of the cStartRect of control i * (320/768)) into tIphoneRect4
-- -- set the cIphoneStartRect of control i to tIphoneRect1, tIphoneRect2, tIphoneRect3, tIphoneRect4
-- -- set the cIphoneStartTextSize of control i to ((the cStarttextSize of control i) * .4)
-- -- set the cIphoneStartTextHeight of control i to ((the cStarttextHeight of control i) * .4)
-- set the rect of control i to the cIphoneStartRect of control i
-- set the textSize of control i to the cIphoneStartTextSize of control i
-- set the textHeight of control i to the cIphoneStartTextHeight of control i
-- end if
-- -- show control i
-- end repeat
-- end if
-- set the rect of btn "tile1" to 55, 100, 105, 150
-- set the rect of btn "tile2" to 110, 100, 160, 150
-- set the rect of btn "tile3" to 165, 100, 215, 150
-- set the rect of btn "tile4" to 55, 155, 105, 205
-- set the rect of btn "tile5" to 110, 155, 160, 205
-- set the rect of btn "tile6" to 165, 155, 215, 205
-- set the rect of btn "tile7" to 55, 210, 105, 260
-- set the rect of btn "tile8" to 110, 210, 160, 260
-- set the rect of btn "tile9" to 165, 210, 215, 260
-- set the rect of btn "Shuffle" to 170, 215, 220, 265
-- set the rect of fld "Bot Time" to 170, 215, 220, 265
-- set the rect of fld "Human Time" to 170, 215, 220, 265
-- set the rect of fld "Tripp" to 170, 215, 220, 265
-- set the rect of fld "You" to 170, 215, 220, 265
-- set the rect of btn "Stop" to 170, 215, 220, 265
-- set the rect of fld "Best Tripp Time" to 170, 215, 220, 265
-- set the rect of fld "Best Human Time" to 170, 215, 220, 265
end resetButtons
-- set the rectangle of btn "tile1" to 120, 25, 195, 100
-- set the rectangle of btn "tile2" to 200, 25, 275, 100
-- set the rectangle of btn "tile3" to 280, 25, 355, 100
-- set the rectangle of btn "tile4" to 120, 105, 195, 180
-- set the rectangle of btn "tile5" to 200, 105, 275, 180
-- set the rectangle of btn "tile6" to 280, 105, 355, 180
-- set the rectangle of btn "tile7" to 120, 185, 195, 260
-- set the rectangle of btn "tile8" to 200, 185, 275, 260
-- set the rectangle of btn "tile9" to 280, 185, 355, 260
-- set the rectangle of img "shard1.png" to 120, 25, 195, 100
-- set the rectangle of img "shard2.png" to 200, 25, 275, 100
-- set the rectangle of img "shard3.png" to 280, 25, 355, 100
-- set the rectangle of img "shard4.png" to 120, 105, 195, 180
-- set the rectangle of img "shard5.png" to 200, 105, 275, 180
-- set the rectangle of img "shard6.png" to 280, 105, 355, 180
-- set the rectangle of img "shard7.png" to 120, 185, 195, 260
-- set the rectangle of img "shard8.png" to 200, 185, 275, 260
-- set the rectangle of img "shard9.png" to 280, 185, 355, 260
-- if (the machine is "iPhone") or \
-- (the machine is "iPod Touch") or \
-- (the width of this stack is 480) or \
-- (the machine is "iPhone Simulator") then
-- defineCard
-- if (the machine is "iPad") or \
-- (the width of this stack is 1024) then
-- set the rectangle of btn "tile1" to 272, 125, 422, 275
-- set the rectangle of btn "tile2" to 437, 125, 587, 275
-- set the rectangle of btn "tile3" to 602, 125, 752, 275
-- set the rectangle of btn "tile4" to 272, 290, 422, 440
-- set the rectangle of btn "tile5" to 437, 290, 587, 440
-- set the rectangle of btn "tile6" to 602, 290, 752, 440
-- set the rectangle of btn "tile7" to 272, 455, 422, 605
-- set the rectangle of btn "tile8" to 437, 455, 587, 605
-- set the rectangle of btn "tile9" to 602, 455, 752, 605
-- set the rectangle of img "shard1.png" to 272, 125, 422, 275
-- set the rectangle of img "shard2.png" to 437, 125, 587, 275
-- set the rectangle of img "shard3.png" to 602, 125, 752, 275
-- set the rectangle of img "shard4.png" to 272, 290, 422, 440
-- set the rectangle of img "shard5.png" to 437, 290, 587, 440
-- set the rectangle of img "shard6.png" to 602, 290, 752, 440
-- set the rectangle of img "shard7.png" to 272, 455, 422, 605
-- set the rectangle of img "shard8.png" to 437, 455, 587, 605
-- set the rectangle of img "shard9.png" to 602, 455, 752, 605
-- set the rectangle of btn "Tripp" to 524, 620, 752, 695
-- set the rectangle of btn "You" to 274, 620, 508, 695
-- set the rectangle of fld "Timer" to 850, 0, 1024, 80
-- set the rectangle of fld "Best Time" to 0, 0, 212, 80
-- set the rectangle of fld "Reset" to 860, 630, 960, 705
-- set the rectangle of fld "SuperSwaps" to 0, 320, 208, 395
-- set the rectangle of btn "numbers" to 860, 320, 935, 395
-- set the rectangle of img "pictures" to 860, 320, 935, 395
-- -- set the textSize of fld "Timer" to 18
-- -- set the textSize of fld "Best Time" to 18
-- -- set the textSize of fld "SuperSwaps" to 18
-- -- set the textSize of fld "RESET" to 18
-- repeat with i = 1 to the number of buttons on this card
-- -- if button i contains "tile" then
-- set the textSize of btn i to 70
-- set the textHeight of btn i to 100
-- -- end if
-- end repeat
-- -- set the textSize of button "Solve" to 10
-- repeat with n = 1 to the number of fields on this card
-- set the textSize of fld n to 22
-- end repeat
-- end if
-- if (the machine is "iPhone") or \
-- (the machine is "iPod Touch") or \
-- (the width of this stack is 480) or \
-- (the machine is "iPhone Simulator") then
-- put 75 into sWidth
-- put 75 into sHeight
-- put 5 into sOffset
-- repeat with i = 1 to the number of controls in this card
-- put round (item 1 of the cStartRect of control i * (480/1024)) into tIphoneRect1
-- put round (item 2 of the cStartRect of control i * (320/768)) into tIphoneRect2
-- put round (item 3 of the cStartRect of control i * (480/1024)) into tIphoneRect3
-- put round (item 4 of the cStartRect of control i * (320/768)) into tIphoneRect4
-- -- set the cIphoneStartRect of control i to tIphoneRect1, tIphoneRect2, tIphoneRect3, tIphoneRect4
-- set the rect of control i to the cIphoneStartRect of control i
-- -- set the cIphoneStartTextSize of control i to round((the cStartTextSize of control i) * .45)
-- set the textSize of control i to the cIphoneStartTextSize of control i
-- -- set the cIphoneStartTextHeight of control i to round((the cStartTextHeight of control i) * .45)
-- set the textHeight of control i to the cIphoneStartTextHeight of control i
-- set the rect of img "Return.png" to the cIphoneStartRect of img "Return.png"
-- show control i
-- set the rectangle of btn "tile1" to 120, 25, 195, 100
-- set the rectangle of btn "tile2" to 200, 25, 275, 100
-- set the rectangle of btn "tile3" to 280, 25, 355, 100
-- set the rectangle of btn "tile4" to 120, 105, 195, 180
-- set the rectangle of btn "tile5" to 200, 105, 275, 180
-- set the rectangle of btn "tile6" to 280, 105, 355, 180
-- set the rectangle of btn "tile7" to 120, 185, 195, 260
-- set the rectangle of btn "tile8" to 200, 185, 275, 260
-- set the rectangle of btn "tile9" to 280, 185, 355, 260
-- set the rectangle of img "shard1.png" to 120, 25, 195, 100
-- set the rectangle of img "shard2.png" to 200, 25, 275, 100
-- set the rectangle of img "shard3.png" to 280, 25, 355, 100
-- set the rectangle of img "shard4.png" to 120, 105, 195, 180
-- set the rectangle of img "shard5.png" to 200, 105, 275, 180
-- set the rectangle of img "shard6.png" to 280, 105, 355, 180
-- set the rectangle of img "shard7.png" to 120, 185, 195, 260
-- set the rectangle of img "shard8.png" to 200, 185, 275, 260
-- set the rectangle of img "shard9.png" to 280, 185, 355, 260
-- -- set the rectangle of btn "Shuffle" to 120, 265, 355, 295
-- -- repeat with i = 1 to the number of buttons on this card
-- -- -- if button i contains "tile" then
-- -- set the textSize of btn i to 70
-- -- set the textHeight of btn i to 100
-- -- -- end if
-- -- end repeat
-- repeat with n = 1 to the number of fields on this card
-- set the textSize of fld n to 10
-- end repeat
-- end if
-- -- set the moveSpeed to 9535
-- move button "b1" to 347, 200 //in 10 milliseconds
-- move button "b2" to 512, 200 //in 10 milliseconds
-- move button "b3" to 677, 200 //in 10 milliseconds
-- move button "b4" to 347, 365// in 10 milliseconds
-- move button "b5" to 512, 365// in 10 milliseconds
-- move button "b6" to 677, 365 //in 10 milliseconds
-- move button "b7" to 347, 530// in 10 milliseconds
-- move button "b8" to 512, 530 //in 10 milliseconds
-- move button "b9" to 677, 530 //in 10 milliseconds
-- repeat with i = 1 to the number of buttons in this card
-- set the backgroundColor of button i to "blue"
-- set the textColor of button i to red
-- if the name of the target contains "tile" then
-- set the cStartLoc of button i to the loc of button ("tile" & i)
-- end if
-- -- end repeat
-- if (the machine is "iPhone") or \
-- (the machine is "iPod Touch") or \
-- (the width of this stack is 480) or \
-- (the machine is "iPhone Simulator") then
-- put 75 into sWidth
-- put 75 into sHeight
-- put 5 into sOffset
-- set the textSize of fld "Timer" to 14
-- repeat with i = 1 to the number of buttons on this card
-- -- if i contains "tile" then
-- set the textSize of btn i to 30
-- set the textHeight of btn i to 40
-- -- end if
-- end repeat
-- set the textSize of fld "Timer" to 18
-- repeat with n = 1 to the number of fields on this card
-- set the textSize of fld n to 25
-- end repeat
-- set the rectangle of btn "tile1" to 120, 40, 195, 115
-- set the rectangle of btn "tile2" to 200, 40, 275, 115
-- set the rectangle of btn "tile3" to 280, 40, 355, 115
-- set the rectangle of btn "tile4" to 120, 120, 195, 195
-- set the rectangle of btn "tile5" to 200, 120, 275, 195
-- set the rectangle of btn "tile6" to 280, 120, 355, 195
-- set the rectangle of btn "tile7" to 120, 200, 195, 275
-- set the rectangle of btn "tile8" to 200, 200, 275, 275
-- set the rectangle of btn "tile9" to 280, 200, 355, 275
-- set the rectangle of img "shard1.png" to 120, 40, 195, 115
-- set the rectangle of img "shard2.png" to 200, 40, 275, 115
-- set the rectangle of img "shard3.png" to 280, 40, 355, 115
-- set the rectangle of img "shard4.png" to 120, 120, 195, 195
-- set the rectangle of img "shard5.png" to 200, 120, 275, 195
-- set the rectangle of img "shard6.png" to 280, 120, 355, 195
-- set the rectangle of img "shard7.png" to 120, 200, 195, 275
-- set the rectangle of img "shard8.png" to 200, 200, 275, 275
-- set the rectangle of img "shard9.png" to 280, 200, 355, 275
-- set the rectangle of btn "Shuffle" to 120, 280, 355, 310
-- set the rectangle of fld "Timer" to 380, 0, 480, 100
-- set the rectangle of fld "Best Time" to 0, 0, 100, 100
-- set the rectangle of fld "Reset" to 370, 260, 470, 310
-- set the rectangle of fld "SuperSwaps" to 0, 120, 100, 220
-- set the rectangle of btn "numbers" to 400, 130, 450, 180
-- set the rectangle of img "pictures" to 400, 130, 450, 180
-- end if
on startHumanTimer
put 0 into line 2 of fld "Human Time"
put the seconds - gStartTime into gYourTime
put gYourTime into line 2 of fld "Human Time"
send "startHumanTimer" to me in 1 second
end startHumanTimer
on startBotTimer
put 0 into line 2 of fld "Bot Time"
put the seconds - gStartTime into gBotTime
put gBotTime into line 2 of fld "Bot Time"
send "startBotTimer" to me in 1 second
end startBotTimer
on finishBotPuzzle
repeat for each line aLine in the pendingMessages
if aLine contains "startBotTimer" then
cancel item 1 of aLine
end if
end repeat
wait 1 milliseconds with messages
if gBestBotTime = 0 then
put gBotTime into gBestBotTime
put gBestBotTime into line 2 of fld "Best Bot Time"
end if
if gBotTime < gBestBotTime is true then
put gBotTime into gBestBotTime
put gBestBotTime into line 2 of fld "Best Bot Time"
-- answer "Best Tripp Time!"
-- else
-- answer "Done!"
end if
set the cTrippFinished of this card to "yes"
-- set the cFinishable of me to "no"
set the cBestBotTime of me to gBestBotTime
end finishBotPuzzle
on finishHumanPuzzle
repeat for each line aLine in the pendingMessages
if aLine contains "startHumanTimer" then
cancel item 1 of aLine
end if
end repeat
if gBestHumanTime = 0 then
put gYourTime into gBestHumanTime
put gBestHumanTime into line 2 of fld "Best Human Time"
end if
if gYourTime < gBestHumanTime is true then
put gYourTime into gBestHumanTime
put gBestTime into line 2 of fld "Best Human Time"
answer "Best Human Time!"
else if the cTrippFinished of this card is "no" then
answer "You beat Tripp!"
else
answer "Tripp won."
end if
set the cHumanFinished of this card to "yes"
set the cFinishable of me to "no"
set the cBestHumanTime of me to gBestHumanTime
end finishHumanPuzzle