home *** CD-ROM | disk | FTP | other *** search
- global stagewidth, stageheight, stagehtop, stagehbottom, stagehleft, stagehright, stagehtop2, stagehbottom2, stagehleft2, stagehright2, startholeh, startholev, panah, panav, panacatchh, panacatchv, panapicuph, panapicupv, panawalkcount, panadir, pananowh, pananowv, defsphanafront, defsphanaback, defspgomfront, defspgomback, defsphead, defrighteye, deflefteye
-
- on panawalk
- cursor([6, 7])
- set mh to the mouseH
- set mv to the mouseV
- set pananowh to the locH of sprite defsphanaback
- set pananowv to the locV of sprite defsphanaback
- set block to 22 * 8 * (panadir - 1)
- set panawalkcount to 1
- set l to 0.0
- repeat while the stillDown
- if (abs(startholeh - the locH of sprite defsphead) < 23) and (abs(startholev - the locV of sprite defsphead) < 15) then
- return 0
- end if
- set mh to the mouseH
- set mv to the mouseV
- set d to getpanadir(mh, mv)
- if d = -1 then
- next repeat
- else
- if d = 0 then
- set d to panadir
- else
- if d = 3 then
- set the visible of sprite defsphanafront to 0
- set the visible of sprite defspgomfront to 0
- else
- set the visible of sprite defsphanafront to 1
- set the visible of sprite defspgomfront to 1
- end if
- end if
- end if
- set panadir to d
- movelochv(defsphanaback, mh, mv)
- movelochv(defsphanafront, mh, mv)
- set block to 22 * 8 * (panadir - 1)
- set l to setwalkfigure(mh, mv, block, 9)
- setgomhana(pananowh, pananowv, mh, mv)
- updateStage()
- end repeat
- cursor([4, 5])
- if l >= 80.0 then
- if l >= 160.0 then
- if panaboundinghead(mh, mv, block) then
- return 1
- end if
- Wait(20)
- else
- if panaheadcutoff(mh, mv, block) then
- return 1
- end if
- cursor(0)
- if panadir <> 3 then
- panawink()
- end if
- pananoheadwalk(block)
- panaheadpicup()
- Wait(15)
- panaheadcatch()
- Wait(20)
- panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
- end if
- panastop(22 * 8 * (panadir - 1))
- if panadir <> 3 then
- panawink()
- end if
- else
- panaheadboing(mh, mv, block)
- cursor(0)
- panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
- if panadir <> 3 then
- panawink()
- end if
- panastop(22 * 8 * (panadir - 1))
- end if
- return 0
- end
-
- on panastop block
- movelochv(defsphanaback, pananowh, pananowv)
- movelochv(defsphanafront, pananowh, pananowv)
- spriteBox(defspgomback, pananowh, pananowv, pananowh, pananowv)
- spriteBox(defspgomfront, pananowh, pananowv, pananowh, pananowv)
- set th to pananowh - getAt(panah, block + 1)
- set tv to pananowv - getAt(panav, block + 1)
- set step to block - 7
- repeat with n = 9 to 28
- movelochv(n, th + getAt(panah, step + n), tv + getAt(panav, step + n))
- end repeat
- updateStage()
- end
-
- on setwalkfigure mh, mv, block, loops
- set h0 to mh - pananowh
- set v0 to mv - pananowv
- set l to sqrt(float((h0 * h0) + (v0 * v0)))
- if l = 0.0 then
- return 0.0
- end if
- set th to integer(h0 / l * 2.0)
- set tv to integer(v0 / l * 2.0)
- if abs(h0) < abs(th) then
- set th to h0
- end if
- if abs(v0) < abs(tv) then
- set tv to v0
- end if
- set pananowh to pananowh + th
- set pananowv to pananowv + tv
- set th to pananowh - getAt(panah, block + 1)
- set tv to pananowv - getAt(panav, block + 1)
- set step to block + (22 * (panawalkcount - 1)) - 7
- repeat with n = loops to 28
- movelochv(n, th + getAt(panah, step + n), tv + getAt(panav, step + n))
- end repeat
- set panawalkcount to panawalkcount + 1
- if panawalkcount = 9 then
- set panawalkcount to 1
- end if
- return l
- end
-
- on panawink
- set the visible of sprite defrighteye to 0
- set the visible of sprite deflefteye to 0
- updateStage()
- Wait(5)
- set the visible of sprite defrighteye to 1
- set the visible of sprite deflefteye to 1
- updateStage()
- Wait(5)
- set the visible of sprite defrighteye to 0
- set the visible of sprite deflefteye to 0
- updateStage()
- Wait(40)
- repeat with n = 1 to 4
- set the visible of sprite defrighteye to 1
- set the visible of sprite deflefteye to 1
- updateStage()
- Wait(5)
- set the visible of sprite defrighteye to 0
- set the visible of sprite deflefteye to 0
- updateStage()
- Wait(5)
- end repeat
- set the visible of sprite defrighteye to 1
- set the visible of sprite deflefteye to 1
- updateStage()
- end
-
- on setgomhana h0, v0, mh, mv
- if h0 < mh then
- if panadir = 4 then
- set h0 to h0 - 1
- else
- set h0 to h0
- end if
- if v0 < mv then
- set the castNum of sprite defspgomback to 2
- set the castNum of sprite defspgomfront to 2
- spriteBox(defspgomback, h0, v0, mh, mv)
- spriteBox(defspgomfront, h0, v0, mh, mv)
- else
- if v0 = mv then
- set mv to mv - 1
- end if
- set the castNum of sprite defspgomback to 3
- set the castNum of sprite defspgomfront to 3
- spriteBox(defspgomback, h0, mv, mh, v0)
- spriteBox(defspgomfront, h0, mv, mh, v0)
- end if
- else
- if panadir = 2 then
- set h1 to h0 + 1
- else
- set h1 to h0
- end if
- if h0 = mh then
- set mh to mh - 1
- end if
- if v0 < mv then
- set the castNum of sprite defspgomback to 3
- set the castNum of sprite defspgomfront to 3
- spriteBox(defspgomback, mh, v0, h1, mv)
- spriteBox(defspgomfront, mh, v0, h1, mv)
- else
- if v0 = mv then
- set mv to mv - 1
- end if
- set the castNum of sprite defspgomback to 2
- set the castNum of sprite defspgomfront to 2
- spriteBox(defspgomback, mh, mv, h1, v0)
- spriteBox(defspgomfront, mh, mv, h1, v0)
- end if
- end if
- end
-
- on getpanadir mh, mv
- set h to mh - pananowh
- set v to mv - pananowv
- if (abs(h) <= 2) and (abs(v) <= 2) then
- return -1
- end if
- if h = 0 then
- if v > 0 then
- set d to 1
- else
- if v < 0 then
- set d to 3
- else
- set d to 0
- end if
- end if
- else
- set c to abs(v / h)
- if h > 0 then
- if v > 0 then
- if c <= 1.0 then
- set d to 4
- else
- set d to 1
- end if
- else
- if c <= 1.0 then
- set d to 4
- else
- set d to 3
- end if
- end if
- else
- if v > 0 then
- if c <= 1.0 then
- set d to 2
- else
- set d to 1
- end if
- else
- if c <= 1.0 then
- set d to 2
- else
- set d to 3
- end if
- end if
- end if
- end if
- if panadir = 1 then
- if (d = 2) and (h < -15) then
- set d to 2
- else
- if (d = 3) and (v < -15) then
- set d to 3
- else
- if (d = 4) and (h > 15) then
- set d to 4
- else
- set d to 0
- end if
- end if
- end if
- else
- if panadir = 2 then
- if (d = 1) and (v > 15) then
- set d to 1
- else
- if (d = 3) and (v < -15) then
- set d to 3
- else
- if d = 4 then
- if h > 30 then
- set d to 4
- else
- if h > 7 then
- set d to 1
- else
- set d to 0
- end if
- end if
- else
- set d to 0
- end if
- end if
- end if
- else
- if panadir = 3 then
- if (d = 1) and (v > 15) then
- set d to 1
- else
- if (d = 2) and (h < -15) then
- set d to 2
- else
- if (d = 4) and (h > 15) then
- set d to 4
- else
- set d to 0
- end if
- end if
- end if
- else
- if panadir = 4 then
- if (d = 1) and (v > 15) then
- set d to 1
- else
- if d = 2 then
- if h < -30 then
- set d to 2
- else
- if h < -15 then
- set d to 1
- else
- set d to 0
- end if
- end if
- else
- if (d = 3) and (v < -15) then
- set d to 3
- else
- set d to 0
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- return d
- end
-