home *** CD-ROM | disk | FTP | other *** search
- on init
- global pillarname, olds, guyX, guyY, gActText, lastset
- set pillarname to "pillar"
- cleanText()
- initWords()
- set olds to 0
- set guyX to 3
- set guyY to 0
- end
-
- on ReturnFromWhereEver
- halt()
- end
-
- on getPart lin, group, part
- global gActText
- set result to line lin of gActText
- set the itemDelimiter to "|"
- set result to item group of result
- set the itemDelimiter to ","
- set result to item part of result
- return result
- end
-
- on cleanText
- global gActText
- repeat with i = length(gActText) down to 1
- if charToNum(char i of gActText) < 32 then
- if char i of gActText <> RETURN then
- delete char i of gActText
- end if
- end if
- end repeat
- end
-
- on initWords
- global gActText, wordList, checkList
- set wordList to []
- set checkList to []
- set the itemDelimiter to ","
- set goodWords to line 6 of gActText
- set badWords to line 7 of gActText
- put line 5 of gActText into field "instr"
- put line 5 of gActText into field "instr2"
- set n1 to the number of items in goodWords
- set n2 to the number of items in badWords
- repeat with x = 1 to 5
- repeat with y = 1 to 7
- set w to item random(n2) of badWords
- if (y = 1) and ((x = 1) or (x = 5)) then
- set w to EMPTY
- end if
- addAt(wordList, ((x - 1) * 7) + y, w)
- addAt(checkList, ((x - 1) * 7) + y, 0)
- end repeat
- end repeat
- set x to 3
- set y to 0
- repeat while y < 7
- set w to EMPTY
- if the number of items in goodWords > length(goodWords) then
- set goodWords to line 6 of gActText
- end if
- repeat while w = EMPTY
- set r to random(n1)
- set w to item r of goodWords
- put EMPTY into item r of goodWords
- end repeat
- if x = 1 then
- set r to min(max(random(3) - 1, -1), 1)
- else
- if x = 5 then
- set r to min(max(random(3) - 3, -1), 1)
- else
- set r to min(max(random(5) - 3, -1), 1)
- end if
- end if
- if (r = 0) or (y = 0) or (random(5) > 1) then
- set y to y + 1
- end if
- set x to x + r
- if (y = 1) and (x = 1) then
- set x to 2
- end if
- if (y = 1) and (x = 5) then
- set x to 4
- end if
- setAt(wordList, ((x - 1) * 7) + y, w)
- setAt(checkList, ((x - 1) * 7) + y, 1)
- end repeat
- end
-
- on getWord x, y
- global wordList
- return getAt(wordList, ((x - 1) * 7) + y)
- end
-
- on getCheck x, y
- global checkList
- return getAt(checkList, ((x - 1) * 7) + y)
- end
-
- on spreadem
- global pillarname
- repeat with n = 4 to 38
- puppetSprite(n, 1)
- set the stretch of sprite n to 1
- end repeat
- set the stretch of sprite 41 to 1
- repeat with i = 0 to 6
- repeat with j = 0 to 4
- set n to 38 - (i * 5) - j
- if getWord(j + 1, i + 1) <> EMPTY then
- set the castNum of sprite n to the number of cast (pillarname & string(random(2)))
- placeit(n, j + 1, i + 1)
- set the locH of sprite n to the locH of sprite n - 3 + random(7)
- set the locV of sprite n to the locV of sprite n - 3 + random(7)
- next repeat
- end if
- set the castNum of sprite n to 0
- end repeat
- puppetTransition(4, 1, 10, 1)
- puppetSound("slam.wav")
- updateStage()
- end repeat
- puppetTransition(0)
- end
-
- on placeit n, x, y
- set the rect of sprite n to getcoord(n, x, y)
- end
-
- on getcoord n, x, y
- set cn to the castNum of sprite n
- set w to the width of cast cn
- set h to the height of cast cn
- set rx to the locH of the regPoint of cast cn
- set ry to the locV of the regPoint of cast cn
- set x to x - 3
- set s to (100 - (y * 6.5)) * 0.01
- set s2 to (100 - (y * 4)) * 0.01
- set rx to rx * s
- set ry to ry * s
- set x1 to integer(200 + (x * (85 * s)) - rx)
- set x2 to integer(x1 + (w * s))
- set y1 to 250 - (y * 33 * s2) - ry
- set y2 to y1 + (h * s)
- return rect(x1, y1, x2, y2)
- end
-
- on placeguy x, y
- placeit(41, x, y)
- updateStage()
- end
-
- on chart
- set text to RETURN
- repeat with y = 1 to 7
- repeat with x = 1 to 5
- if getCheck(x, 8 - y) then
- put char 1 of getWord(x, 8 - y) after text
- next repeat
- end if
- put "-" after text
- end repeat
- put RETURN after text
- end repeat
- put text
- end
-