うきうきスキー
テクニカルノート
うきうきスキー改良版の技術的な説明をします。下手なスクリプトなので、詳しく説明するとボロがでるので、やめておきます(笑)
もしソースデータをご希望の方はこちらまでご連絡下さい。
初期設定スクリプト
このスクリプトでは様々なグローバル変数の設定と同時に、数々のハンドラを記述しています。コメントを参考にお読み下さい。
on startMovie
global treeList,dif,damage,tensuu,bonus,lastscore
set lastscore to 0
set tensuu to 0
set dif to 2
set damage to 0
set treeList=[0,0,0,0,0,0,0,0,0,0]
set bonus to 0
--
repeat with m=10 to 24
puppetSprite m, TRUE
end repeat
--
repeat with n=26 to 30
set the visible of sprite n to true
end repeat
end
--これは雪ダルマの動きを制御するハンドラです
--座標位置を判断し、その次にキー入力により移動させます
--変数difはスクロール速度を決定するものです
on sousa
global dif
put the locH of sprite 1 into H
if H>330 or h<-10 then
go to frame "gameover"
else
if the keycode = 43 or the keycode = 123 then
puppetsound "syu"
move2 yuki, -1
set the castNum of sprite 1 to 2
set dif to dif -0.4
if dif <= 0 then
set dif to 0
end if
else if the keycode = 44 or the keycode = 124 then
puppetsound "syu"
move2 yuki ,1
set the castNum of sprite 1 to 3
set dif to dif - 0.4
if dif <= 0 then
set dif to 0
end if
else
set the castNum of sprite 1 to 4
set dif to dif + 0.25
move2 yuki , 0
end if
end if
end
--
--当たり判定のハンドラです
--まず背景のスプライトと重なっているかをチェックします
--その次にどの種類のスプライトかを判断します
on hantei
global treeList,damage,dif,tensuu,bonus,lastscore
repeat with m=10 to 20
if sprite 1 intersects sprite m then
if the castNum of sprite m = 28 then
puppetsound 2 "lucky"
set the castNum of sprite m to 29
set bonus to bonus +10000
updatestage
else
if the castNum of sprite m = 29 then
nothing
else
puppetsound 2 "ite"
set damage to damage +1
set the visible of sprite damage + 25 to false
updatestage
end if
end if
end if
if damage = 5 then
put integer(the timer *(power(dif, 2)-8)) + bonus into lastscore
go to frame "gameover"
set damage to 0
repeat with a=33 to 38
set the visible of sprite a to TRUE
end repeat
else
nothing
end if
end repeat
end
---
--雪ダルマをふるえさせるハンドラです
on hurue
put the locH of sprite 1 into H
if random(2) =1 then
set the locH of sprite 1 to H +random(3)
else
set the locH of sprite 1 to H -random(3)
end if
-----
on stopMovie
repeat with m=10 to 40
puppetSprite m, False
end repeat
end
--
on score
global dif,tensuu,bonus
put integer(the timer *(power(dif, 2)-8)) + bonus into field "score"
end
--
背景制作の親スクリプト"oya"
property yoko, tate,castNum
on new me ,ListPosition
set the yoko of me to random(9)*30 +random(40)
set the tate of me to random(3)*100 +random(60)
set the castNum of me to random(3)+26
return me
end
on move me, spNum
set the locH of sprite spNum to the yoko of me
set the locV of sprite spNum to the tate of me
updatestage
end
on zurasu me,Spnum
global dif
set the locV of sprite spNum to the tate of me -dif
set the tate of me to the tate of me -dif
if the tate of me < -30 then
set the yoko of me to random(30)*9+random(40)
set the tate of me to 320 + random(30)
set the locH of sprite spNum to the yoko of me
set the castNum of sprite spNum to random(3)+25
end if
updatestage
end
背景制作の命令"haiti"
on haiti
global TreeList
repeat with m=1 to 10
addAt TreeList, m, new(script"oya",m)
move getAt(TreeList, m),m+10
end repeat
end
雪ダルマの親スクリプト
on new me
puppetSprite 1,true
set the locV of sprite 1 to 100
set the locH of sprite 1 to 160
set the castNum of sprite 1 to 4
updatestage
return me
end
on move2 me , direction
put the locH of sprite 1 into H
set the locH of sprite 1 to H + 10*direction
updatestage
end
雪ダルマの制作スクリプト
on exitFrame
global yuki
set yuki to new (script"oya2")
move2 yuki,0
end
背景を動かすためのスクリプト
on exitFrame
global treeList
haiti
repeat with m=1 to 10
zurasu getAt(treeList,m) ,M+10
end repeat
end
© Akira SAno 1996
一応こんなページでも著作権は佐野彰に存在します
リンクフリーですが、メールでご連絡頂けたら嬉しいです。
96/10/24更新
ホームに戻る