home *** CD-ROM | disk | FTP | other *** search
- global stagewidth, stageheight, stagehtop, stagehbottom, stagehleft, stagehright, stagehtop2, stagehbottom2, stagehleft2, stagehright2, startholeh, startholev, startholeh2, startholev2, panah, panav, panacatchh, panacatchv, panapicuph, panapicupv, panaboundh, panaboundv, panawalkcount, panadir, pananowh, pananowv, panacharh0, panacharv0, panacharha, panacharva, cl_pana, cl_sonic, cl_fun_city, cl_olympic, cl_yawara_chan, cl_time_capusule, panacharlist, panacharcount, panacharend, defsphanafront, defsphanaback, defspgomfront, defspgomback, defsphead, defrighteye, deflefteye
-
- on panaboundinghead mh, mv, block
- if (pananowh < stagehleft2) or (pananowh > stagehright2) or (pananowv < stagehtop2) or (pananowv > stagehbottom2) then
- panaheadcatch()
- cursor(0)
- panabacktostage(the locH of sprite defsphanaback, the locV of sprite defsphanaback)
- return 0
- end if
- set av to -(mv - pananowv) / 2.0
- set ah to -(mh - pananowh) / 2.0
- set h0 to the locH of sprite defsphead
- set v0 to the locV of sprite defsphead
- set h00 to h0
- set v00 to v0
- set hh to getAt(panah, block + 1) - getAt(panah, block + 2)
- set vv to getAt(panav, block + 1) - getAt(panav, block + 2)
- set panasw to 0
- set timeh to 0.40000000000000002
- set timev to 0.40000000000000002
- repeat while 1
- set h1 to h0 + (ah * timeh)
- set v1 to v0 + (av * timev)
- if (h1 < stagehleft) and (ah < 0.0) then
- if (panasw = 0) and (random(15) = 1) then
- set panasw to 1
- end if
- set h1 to stagehleft
- set h0 to stagehleft
- set ah to -ah
- set timeh to 0.0
- else
- if (h1 > stagehright) and (ah > 0.0) then
- if (panasw = 0) and (random(15) = 1) then
- set panasw to 1
- end if
- set h1 to stagehright
- set h0 to stagehright
- set ah to -ah
- set timeh to 0.0
- end if
- end if
- if (v1 < stagehtop) and (av < 0.0) then
- if (panasw = 0) and (random(15) = 1) then
- set panasw to 1
- end if
- set v1 to stagehtop
- set v0 to stagehtop
- set av to -av
- set timev to 0.0
- else
- if (v1 > stagehbottom) and (av > 0.0) then
- if (panasw = 0) and (random(15) = 1) then
- set panasw to 1
- end if
- set v1 to stagehbottom
- set v0 to stagehbottom
- set av to -av
- set timev to 0.0
- end if
- end if
- if panasw > 0 then
- set panasw to panacharbound(h1, v1, ah, av, panasw)
- end if
- if pointandline(h00, v00, integer(h1), integer(v1)) then
- exit repeat
- end if
- if pointandline(startholeh2, startholev2, integer(h1), integer(v1)) then
- return 1
- end if
- movelochv(defsphead, h1, v1)
- set h to h1 + hh
- set v to v1 + vv
- movelochv(defsphanafront, h, v)
- movelochv(defsphanaback, h, v)
- spriteBox(defspgomfront, h, v, h, v)
- spriteBox(defspgomback, h, v, h, v)
- updateStage()
- set timeh to timeh + 0.40000000000000002
- set timev to timev + 0.40000000000000002
- end repeat
- cursor(0)
- panaheadcatch()
- repeat while panasw <> 0
- set panasw to panacharbound(h1, v1, ah, av, panasw)
- Wait(2)
- updateStage()
- end repeat
- return 0
- end
-
- on panacharbound h0, v0, ah, av, panasw
- if panasw = 1 then
- set panacharh0 to h0
- set panacharv0 to v0
- set panacharha to ah / 1.69999999999999996 * 0.40000000000000002
- set panacharva to av / 1.69999999999999996 * 0.40000000000000002
- setpanacharlist()
- set panacharcount to count(panacharlist)
- set panacharend to (panacharcount * 5) + 4
- end if
- set c to (panasw / 10 * 2) + 1
- if c <= panacharcount then
- set t to panasw mod 10
- if t = 1 then
- set the castNum of sprite 31 to getAt(panacharlist, c)
- end if
- if (t >= 1) and (t <= 8) then
- set t to t - 1
- set h to panacharha * t
- set v to panacharva * t
- movelochv(31, panacharh0 + (t * panacharha), panacharv0 + (t * panacharva))
- else
- if t = 9 then
- movelochv(31, -200, -200)
- end if
- end if
- end if
- set c to (panasw + 5) / 10 * 2
- if (c > 0) and (c <= panacharcount) then
- set t to (panasw - 5) mod 10
- if t = 1 then
- set the castNum of sprite 32 to getAt(panacharlist, c)
- end if
- if (t >= 1) and (t <= 8) then
- set t to t - 1
- set h to panacharha * t
- set v to panacharva * t
- movelochv(32, panacharh0 + (t * panacharha), panacharv0 + (t * panacharva))
- else
- if t = 9 then
- movelochv(32, -200, -200)
- end if
- end if
- end if
- set panasw to panasw + 1
- if panasw > panacharend then
- set panasw to 0
- end if
- return panasw
- end
-
- on pointandline h00, v00, h1, v1
- if (abs(h1 - h00) < 30) and (abs(v1 - v00) < 30) then
- return 1
- end if
- set h0 to the locH of sprite defsphead
- set v0 to the locV of sprite defsphead
- if (h0 = h00) and (v0 = v00) then
- return 0
- end if
- if h0 < h1 then
- set x0 to h0
- set x1 to h1
- else
- set x0 to h1
- set x1 to h0
- end if
- if v0 < v1 then
- set y0 to v0
- set y1 to v1
- else
- set y0 to v1
- set y1 to v0
- end if
- if (x0 <= h00) and (h00 <= x1) and (y0 <= v00) and (v00 <= y1) then
- if h0 = h1 then
- return 1
- else
- set a to float(v1 - v0)
- set b to float(h0 - h1)
- set c to float((-b * v0) - (a * h0))
- if (abs((a * h00) + (b * v00) + c) / sqrt((a * a) + (b * b))) < 30 then
- return 1
- end if
- end if
- end if
- return 0
- end
-
- on panaheadcatch
- 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(panacatchh, (22 * (panadir - 1)) + 1)
- set tv to pananowv - getAt(panacatchv, (22 * (panadir - 1)) + 1)
- set step to (22 * (panadir - 1)) - 7
- repeat with n = 9 to 28
- movelochv(n, th + getAt(panacatchh, step + n), tv + getAt(panacatchv, step + n))
- end repeat
- updateStage()
- end
-
- on panaheadpicup
- set th to pananowh - getAt(panacatchh, (22 * (panadir - 1)) + 1)
- set tv to pananowv - getAt(panacatchv, (22 * (panadir - 1)) + 1)
- set step to (22 * (panadir - 1)) - 7
- repeat with n = 10 to 28
- movelochv(n, th + getAt(panapicuph, step + n), tv + getAt(panapicupv, step + n))
- end repeat
- updateStage()
- end
-
- on pananoheadwalk block
- set mh to (the left of sprite defsphead + the right of sprite defsphead) / 2
- set mv to the bottom of sprite defsphead + getAt(panav, block + 1)
- set d to getpanadir(mh, mv)
- if d = -1 then
- else
- if d = 0 then
- set d to panadir
- end if
- set panadir to d
- set block to 22 * 8 * (panadir - 1)
- repeat while 1
- set d to getpanadir(mh, mv)
- if d = -1 then
- exit 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
- set l to setwalkfigure(mh, mv, block, 10)
- updateStage()
- if l < 20 then
- exit repeat
- end if
- end repeat
- end if
- if panadir = 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
-
- on panabacktostage mh, mv
- set backtostageh to 0
- if mh < stagehleft2 then
- set mh to stagehleft2
- set backtostageh to 1
- else
- if mh > stagehright2 then
- set mh to stagehright2
- set backtostageh to 1
- end if
- end if
- set backtostagev to 0
- if mv < stagehtop2 then
- set mv to stagehtop2
- set backtostagev to 1
- else
- if mv > stagehbottom2 then
- set mv to stagehbottom2
- set backtostagev to 1
- end if
- end if
- if (backtostageh + backtostagev) <> 0 then
- set l to 0.0
- set d to getpanadir(mh, mv)
- 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
- if d = -1 then
- else
- if d = 0 then
- set d to panadir
- end if
- set panadir to d
- set block to 22 * 8 * (panadir - 1)
- repeat while 1
- set d to getpanadir(mh, mv)
- if d = -1 then
- exit 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, pananowh, pananowv)
- movelochv(defsphanafront, pananowh, pananowv)
- set l to setwalkfigure(mh, mv, block, 9)
- updateStage()
- if l < 1 then
- exit repeat
- end if
- end repeat
- end if
- end if
- end
-
- on panaheadcutoff mh, mv, block
- set h0 to pananowh - getAt(panah, block + 1)
- set v0 to pananowv - getAt(panav, block + 1)
- set av to -(mv - pananowv) / 2.0
- set ah to -(mh - pananowh) / 5.0
- set g to -8.0
- set b to the bottom of sprite defsphead - v0
- set b2 to the bottom of sprite defsphead - the locV of sprite defsphead
- set hh to getAt(panah, block + 1) - getAt(panah, block + 2)
- set vv to getAt(panav, block + 1) - getAt(panav, block + 2)
- set h00 to h0
- if mh = pananowh then
- set mh to mh + power(-1, random(2))
- end if
- if mv = pananowv then
- set mv to mv + power(-1, random(2))
- end if
- set da to -float(mv - pananowv) / float(mh - pananowh) * 0.20000000000000001
- set t to 0.10000000000000001
- set t2 to 1
- set toph to v0
- set panasw to 0
- repeat while 1
- set v to (av * t) - (g * t * t) + b + v0
- set h to (ah * t) + h0
- if v < toph then
- set toph to v
- end if
- if v > v0 then
- set t to (av - sqrt((av * av) + (4.0 * b * g))) / (2.0 * g)
- set h to (ah * t) + h0
- set h0 to h
- set b to 0.0
- set av to av * 0.90000000000000002
- set ah to ah * 0.69999999999999996
- if av > 0.0 then
- set av to -av
- end if
- set t to 0.0
- if (v0 - toph) < 15 then
- set toph to -10000
- else
- set toph to v0
- end if
- if (panasw = 0) and (random(12) = 1) then
- set panasw to 1
- end if
- next repeat
- end if
- set v to v - b2 + (da * -(h - h00))
- movelochv(defsphead, h, v)
- if panasw > 0 then
- set panasw to panacharjumpout(h, v, ah, av, panasw)
- end if
- set h to h + hh
- set v to v + vv
- movelochv(defsphanafront, h, v)
- movelochv(defsphanaback, h, v)
- spriteBox(defspgomfront, h, v, h, v)
- spriteBox(defspgomback, h, v, h, v)
- updateStage()
- if (t = 0.0) and (abs(startholeh2 - the locH of sprite defsphead) < 15) and (abs(startholev2 - the locV of sprite defsphead) < 15) then
- return 1
- end if
- if toph = -10000 then
- exit repeat
- end if
- set t to t + 0.40000000000000002
- set t2 to t2 + 1
- end repeat
- repeat while panasw <> 0
- set panasw to panacharjumpout(h, v, ah, av, panasw)
- Wait(2)
- updateStage()
- end repeat
- return 0
- end
-
- on panacharjumpout h, v, ha, va, panasw
- if panasw = 1 then
- set panacharh0 to h
- set panacharv0 to v
- set panacharha to abs(ha) * 0.10000000000000001
- set panacharva to abs(va) * 0.1285
- setpanacharlist()
- set panacharcount to count(panacharlist)
- set panacharend to (panacharcount * 5) + 4
- end if
- set c to (panasw / 10 * 2) + 1
- if c <= panacharcount then
- set t to panasw mod 10
- if t = 1 then
- set the castNum of sprite 31 to getAt(panacharlist, c)
- end if
- if (t >= 1) and (t <= 8) then
- set h to panacharha * t
- set v to panacharva * t
- movelochv(31, panacharh0 + getAt(panaboundh, t) + h, panacharv0 + getAt(panaboundv, t) - v)
- else
- if t = 9 then
- movelochv(31, -200, -200)
- end if
- end if
- end if
- set c to (panasw + 5) / 10 * 2
- if (c > 0) and (c <= panacharcount) then
- set t to (panasw - 5) mod 10
- if t = 1 then
- set the castNum of sprite 32 to getAt(panacharlist, c)
- end if
- if (t >= 1) and (t <= 8) then
- set h to panacharha * t
- set v to panacharva * t
- movelochv(32, panacharh0 - getAt(panaboundh, t) - h, panacharv0 + getAt(panaboundv, t) - v)
- else
- if t = 9 then
- movelochv(32, -200, -200)
- end if
- end if
- end if
- set panasw to panasw + 1
- if panasw > panacharend then
- set panasw to 0
- end if
- return panasw
- end
-
- on setpanacharlist
- set r to random(6)
- if r = 1 then
- set panacharlist to cl_pana
- else
- if r = 2 then
- set panacharlist to cl_sonic
- else
- if r = 3 then
- set panacharlist to cl_fun_city
- else
- if r = 4 then
- set panacharlist to cl_olympic
- else
- if r = 5 then
- set panacharlist to cl_yawara_chan
- else
- set panacharlist to cl_time_capusule
- end if
- end if
- end if
- end if
- end if
- end
-
- on panaheadboing mh, mv, block
- set i to 1
- set h to 0
- set v to 0
- set step to block + 2
- set th to pananowh - getAt(panah, block + 1) + getAt(panah, step)
- set tv to pananowv - getAt(panav, block + 1) + getAt(panav, step)
- repeat while 1
- set h to (mh - pananowh) / i * power(-1, i)
- set v to (mv - pananowv) / i * power(-1, i)
- set h2 to h / 2
- set v2 to v / 2
- if ((h * h) + (v * v)) < 4 then
- exit repeat
- end if
- movelochv(defsphanaback, pananowh + h2, pananowv + v2)
- movelochv(defsphanafront, pananowh + h2, pananowv + v2)
- setgomhana(pananowh + h, pananowv + v, pananowh + h2, pananowv + v2)
- movelochv(defsphead, th + h, tv + v)
- updateStage()
- set i to i + 1
- end repeat
- end
-