(未完成)料理対決のスクリプト(RPGエディタ)
      投稿者:
 mosmoss
     投稿日:2017/07/30 11:26
    
前置き
幻想水滸伝2のミニゲームである料理対決を
Rmakeでできないかなと思って研究中です
スプライトを重ねて、会場と審査員、司会、料理人、料理を表示し
料理データと審査員データから計算して得点を作るという趣旨です
現在は、会場の表示、審査員の選出と表示、料理の選出、
審査の演出までできていて、
調理演出、審査員データと料理データ、得点計算式がまだの状態です
開始スクリプト
#料理対決のステージ数
setVariable("stage",0+getVariable("stage"))
#引数から配列を得る関数
def array2(a00,a01,a02,a03,a04,a05,a06,a07,a08,a09,a10,a11,a12,a13,a14,a15)
 a=createArray()
 if toString(a00)=="null"&&a00!="null" then return a;else pushArray(a,a00);end
 if toString(a01)=="null"&&a01!="null" then return a;else pushArray(a,a01);end
 if toString(a02)=="null"&&a02!="null" then return a;else pushArray(a,a02);end
 if toString(a03)=="null"&&a03!="null" then return a;else pushArray(a,a03);end
 if toString(a04)=="null"&&a04!="null" then return a;else pushArray(a,a04);end
 if toString(a05)=="null"&&a05!="null" then return a;else pushArray(a,a05);end
 if toString(a06)=="null"&&a06!="null" then return a;else pushArray(a,a06);end
 if toString(a07)=="null"&&a07!="null" then return a;else pushArray(a,a07);end
 if toString(a08)=="null"&&a08!="null" then return a;else pushArray(a,a08);end
 if toString(a09)=="null"&&a09!="null" then return a;else pushArray(a,a09);end
 if toString(a10)=="null"&&a10!="null" then return a;else pushArray(a,a10);end
 if toString(a11)=="null"&&a11!="null" then return a;else pushArray(a,a11);end
 if toString(a12)=="null"&&a12!="null" then return a;else pushArray(a,a12);end
 if toString(a13)=="null"&&a13!="null" then return a;else pushArray(a,a13);end
 if toString(a14)=="null"&&a14!="null" then return a;else pushArray(a,a14);end
 if toString(a15)=="null"&&a15!="null" then return a;else pushArray(a,a15);end
 return a
end
#配列ソート関数
def pivot2(arr,index,i,j,ord)
  k = i + 1
  while (k <= j) && (arr[i][index] == arr[k][index]) do k = k + 1; end
  if k > j then return -1; end
  if ord
    if arr[i][index] >= arr[k][index] then return i; end
  else
    if arr[i][index] <= arr[k][index] then return i; end
  end
  return k
end
def partition2(arr,index,i,j,x,ord)
  l = i; r = j
  while l <= r
    if ord
      while (l <= j) && (arr[l][index] < x) do l = l + 1; end
      while (r >= i) && (arr[r][index] >= x) do r = r - 1; end
    else
      while (l <= j) && (arr[l][index] > x) do l = l + 1; end
      while (r >= i) && (arr[r][index] <= x) do r = r - 1; end
    end
    if l <= r
      t = arr[l]; arr[l] = arr[r]; arr[r] = t
      l = l + 1; r = r - 1
    end
  end
  return l
end
def quickSort2(arr,index,i,j,ord)
  if i != j
    p = pivot2(arr,index,i,j,ord)
    if p != -1
      k = partition2(arr,index,i,j,arr[p][index],ord)
      arr = quickSort2(arr,index,i,(k - 1),ord)
      arr = quickSort2(arr,index,k,j,ord)
    end
  end
  return arr
end
#使用時はこの関数のみ
#第1引数:配列 第2引数:ソート対象のインデックス 第3引数:昇順 true / 降順 false
def sortArray2(arr,index,ord)
  return quickSort2(arr,index,0,(getArrayLength(arr) - 1),ord)
end
#配列をシャッフルする関数
def shuffle(s)#引数sには配列を入れる
  i=getArrayLength(s)-1
  while i>-1
    r = rand(i+1)
    t=s[r]
    s[r]=s[i]
    s[i]=t
    i=i-1
  end
end
#審査員データ 128人のデータを作る
setVariable("judge",array2(1))
i=2
while i < 129
pushArray(getVariable("judge"),array2(i) )
i=i+1
end
#speak(getVariable("judge"))
#指定タイルを表示、また表示内容を変更する関数
def tiled(id,no,x,y,w,h,z,koma) #idはスプライト元画像id、nameは表示したいタイルの番号(名前)、x、yは表示座標(ピクセル単位の画面座標)を表す、w,h,は1タイルの幅と高さ、スプライトを消すか残すか(trueかfalse)
#キャンパスがビジブル状態になっているか否かの判定
#ビジブルでない場合、ビジブル状態にする
#RPGエディタで必要な確認
  if getCanvasVisible()
  else
     setCanvasVisible(true)
  end
#素材画像関連の設定
#id=320421 #fsm128の画像id
imgw=512 #素材画像全体の横幅
imgh=384 #素材画像全体の縦幅
#koma=16 #一行あたりのコマ数
#ここからスプライト設定
    img_name = "img"
    #画像ハンドル名はimg_emoticonにしてみました
   #お好みで変えてください
    get_x = 0;    get_y = 0;    get_w = w;   get_h = h
    set_x = 0;    set_y = 0;    set_w = w;   set_h = h
a=floor(no/koma) #行数
b=no-(a*koma) #余
if no<=0
        get_w = 0;    get_h = 0
        set_w = 0;    set_h = 0
elsif no<=koma
        get_x = w*(no-1)
else
  case b
    when 0
        get_x=w*(koma-1)
        get_y=h*(a-1)
    else
        get_x=w*(b-1)
        get_y=h*a
  end #case
end #if no<=0
    img= createSprite(id)    
    setSpriteRect(img,
                  get_x, get_y, get_w, get_h, set_x, set_y, set_w, set_h)
    setSpriteZOrder(img, z) 
#レイヤーの前後関係を調節したい場合はここの数値をいじる
    setSpritePosition(img, x, y) #エモグラ表示位置(ピクセル画面座標)
#スプライトの描画
    drawCanvas()
return img
end #def tiled
開始スクリプトでtiled関数を定義しています。
これは、同じ大きさのタイルで組織された一枚絵のスプライトを仮定して
何番目のタイルをどこに表示させるか、という趣旨の関数です。
エディタ内のイベントスクリプト
#料理対決をし、勝敗を返す関数
def taiketu(stage)
deleteAllSprite()
#会場の設定
setCanvasVisible(true) #キャンパス表示
#背景
bg=createSprite(320424)
setSpriteRect(bg, 0, 0, 512, 384, 0, 0, 512, 384)
setSpritePosition(bg, 0, 0)
setSpriteZOrder(bg, 0)
#椅子
chairs=createSprite(320423)
setSpriteRect(chairs, 0, 96, 288, 64, 0, 0, 288, 64)
setSpritePosition(chairs, 112, 32)
setSpriteZOrder(chairs, 1)
#審査委員
#審査員の抽選128人の中から4人選ぶ
shuffle(getVariable("judge"))
j1=getVariable("judge")[0][0]
j2=getVariable("judge")[1][0]
j3=getVariable("judge")[2][0]
j4=getVariable("judge")[3][0]
judge=array2(j1,j2,j3,j4)
speak(judge)
img_j1=tiled(320421,j1,144,48,32,48,2,16) 
#idはスプライト元画像id、nameは表示したいタイルの番号(名前)、x、yは表示座標(ピクセル単位の画面座標)を表す、w,h,は1タイルの幅と高さ、スプライトを消すか残すか(trueかfalse)
img_j2=tiled(320421,j2,208,48,32,48,2,16) 
img_j3=tiled(320421,j3,272,48,32,48,2,16) 
img_j4=tiled(320421,j4,336,48,32,48,2,16) 
#審査テーブル
table=createSprite(320423)
setSpriteRect(table, 0, 0, 288, 96, 0, 0, 288, 96)
setSpritePosition(table, 112, 64)
setSpriteZOrder(table, 3)
#料理(レイヤーは4)
#司会
#調理台
kitchen=createSprite(320423)
setSpriteRect(kitchen, 0, 160, 512, 128, 0, 0, 512, 128)
setSpritePosition(kitchen, 16, 192)
setSpriteZOrder(kitchen, 6)
#料理人
#食材
#foods=createSprite(320423)
#setSpriteRect(foods, 0, 320, 512, 64, 0, 0, 512, 64)
#setSpritePosition(foods, 0, 320)
#setSpriteZOrder(foods, 8)
#スプライト初期会場の描画
drawCanvas()
#対決前のアナウンス
speak("料理対決を始めます")
speak("まずは本日の審査員を紹介します")
speak(judge[0])
speak(judge[1])
speak(judge[2])
speak(judge[3])
speak("続いて挑戦者の入場です")
speak("最後にチャンピオンの入場です")
speak("勝負は料理3品の総合得点で決まります")
speak("それでは準備を始めてください")
#メニュー選択
#選択可能なレシピのリストの作成
all_recipe=createArray()
pushArray(all_recipe, array2(1,"オムレット"))
pushArray(all_recipe, array2(2,"プリン"))
pushArray(all_recipe, array2(3,"だしまきたまご"))
pushArray(all_recipe, array2(4,"ちゃわんむし"))
pushArray(all_recipe, array2(5,"キッシュ"))
pushArray(all_recipe, array2(6,"たまごバクダン"))
pushArray(all_recipe, array2(7,"サラダ"))
pushArray(all_recipe, array2(8,"トマトのコンポート"))
pushArray(all_recipe, array2(9,"キャベツ汁"))
pushArray(all_recipe, array2(10,"きんぴらごぼう"))
pushArray(all_recipe, array2(11,"ポテトサラダ"))
pushArray(all_recipe, array2(12,"ラタトゥイユ"))
pushArray(all_recipe, array2(13,"ブラウンシチュー"))
pushArray(all_recipe, array2(14,"肉じゃが"))
pushArray(all_recipe, array2(15,"ローストビーフ"))
pushArray(all_recipe, array2(16,"おろしステーキ"))
pushArray(all_recipe, array2(17,"タルタルステーキ"))
pushArray(all_recipe, array2(18,"蘭州ラーメン"))
pushArray(all_recipe, array2(19,"シューマイ"))
pushArray(all_recipe, array2(20,"ごまだんご"))
pushArray(all_recipe, array2(21,"ハンバーグ"))
pushArray(all_recipe, array2(22,"やきぎょうざ"))
pushArray(all_recipe, array2(23,"はるまき"))
pushArray(all_recipe, array2(24,"にくづめトウガラシ"))
pushArray(all_recipe, array2(25,"アクアパッツァ"))
pushArray(all_recipe, array2(26,"ぎょにくケーキ"))
pushArray(all_recipe, array2(27,"しおやき"))
pushArray(all_recipe, array2(28,"フィッシューマイ"))
pushArray(all_recipe, array2(29,"ムニエル"))
pushArray(all_recipe, array2(30,"エビチリ"))
pushArray(all_recipe, array2(31,"コンソメスープ"))
pushArray(all_recipe, array2(32,"コーンポタージュ"))
pushArray(all_recipe, array2(33,"サンショーカン"))
pushArray(all_recipe, array2(34,"あかだし"))
pushArray(all_recipe, array2(35,"クラムチャウダー"))
pushArray(all_recipe, array2(36,"トムヤムクン"))
pushArray(all_recipe, array2(37,"おやこどん"))
pushArray(all_recipe, array2(38,"オムライス"))
pushArray(all_recipe, array2(39,"やきとり"))
pushArray(all_recipe, array2(40,"うみのおやこどん"))
pushArray(all_recipe, array2(41,"たつたあげ"))
pushArray(all_recipe, array2(42,"おやこおにぎり"))
pushArray(all_recipe, array2(43,"やみなべ"))
pushArray(all_recipe, array2(44,"すきやき"))
pushArray(all_recipe, array2(45,"かもなべ"))
pushArray(all_recipe, array2(46,"じゃっぱじる"))
pushArray(all_recipe, array2(47,"チーズフォンデュ"))
pushArray(all_recipe, array2(48,"おしどりひなべ"))
pushArray(all_recipe, array2(49,"ゆどうふ"))
pushArray(all_recipe, array2(50,"あんにんどうふ"))
pushArray(all_recipe, array2(51,"たまごどうふ"))
pushArray(all_recipe, array2(52,"とうふみそしる"))
pushArray(all_recipe, array2(53,"とうふドーナツ"))
pushArray(all_recipe, array2(54,"まーぼーどうふ"))
pushArray(all_recipe, array2(55,"もりそば"))
pushArray(all_recipe, array2(56,"アイスラーメン"))
pushArray(all_recipe, array2(57,"しおラーメン"))
pushArray(all_recipe, array2(58,"しょうゆラーメン"))
pushArray(all_recipe, array2(59,"とんこつラーメン"))
pushArray(all_recipe, array2(60,"たんたんめん"))
pushArray(all_recipe, array2(61,"ペペロンチーノ"))
pushArray(all_recipe, array2(62,"チョコパスタ"))
pushArray(all_recipe, array2(63,"カメのパスタ"))
pushArray(all_recipe, array2(64,"イカスミパスタ"))
pushArray(all_recipe, array2(65,"アレフレード"))
pushArray(all_recipe, array2(66,"アラビアータ"))
pushArray(all_recipe, array2(67,"ショートケーキ"))
pushArray(all_recipe, array2(68,"ムーンケーキ"))
pushArray(all_recipe, array2(69,"ケークサレ"))
pushArray(all_recipe, array2(70,"おこのみやき"))
pushArray(all_recipe, array2(71,"チーズケーキ"))
pushArray(all_recipe, array2(72,"ビックリパイ"))
pushArray(all_recipe, array2(73,"サンドイッチ"))
pushArray(all_recipe, array2(74,"フレンチトースト"))
pushArray(all_recipe, array2(75,"マルゲリータ"))
pushArray(all_recipe, array2(76,"てりやきバーガー"))
pushArray(all_recipe, array2(77,"カツサンド"))
pushArray(all_recipe, array2(78,"グラブラックス"))
pushArray(all_recipe, array2(79,"フルーツ"))
pushArray(all_recipe, array2(80,"ももまんじゅう"))
pushArray(all_recipe, array2(81,"なまハムメロン"))
pushArray(all_recipe, array2(82,"フルーツみそしる"))
pushArray(all_recipe, array2(83,"アップルパイ"))
pushArray(all_recipe, array2(84,"シナモンアップル"))
pushArray(all_recipe, array2(85,"チャーハン"))
pushArray(all_recipe, array2(86,"ぼたもち"))
pushArray(all_recipe, array2(87,"ドクドクドリア"))
pushArray(all_recipe, array2(88,"アイアンゾースイ"))
pushArray(all_recipe, array2(89,"リゾット"))
pushArray(all_recipe, array2(90,"パエリア"))
pushArray(all_recipe, array2(91,"ベイクドポテト"))
pushArray(all_recipe, array2(92,"いもようかん"))
pushArray(all_recipe, array2(93,"ヴィシソワーズ"))
pushArray(all_recipe, array2(94,"だいがくいも"))
pushArray(all_recipe, array2(95,"コロッケ"))
pushArray(all_recipe, array2(96,"トゥートウロースー"))
#recipe=array2("オムレット","サラダ","ハンバーグ","魚のソテー","ぶどうジュース","野菜のシチュー","スープセット","アクアパッツァ","ローストチキン","レモネード","もぎたて果物","フルーツ盛り","ショートケーキ","ホールケーキ","紅茶")
recipe_list=array2("オムレット","サラダ","ブラウンシチュー","シューマイ","アクアパッツァ","コンソメスープ","おやこどん","やみなべ","ゆどうふ","もりそば","ペペロンチーノ","ショートケーキ","サンドイッチ","フルーツ","チャーハン","ベイクドポテト")
taste=array2("そのまま","さとう","しお","しょうゆ","マヨネーズ","スパイス")
loop = true
while loop
#チャンピオンのメニューの初期設定
ape=" "
main=" "
desert=" "
ape_loop=true
while ape_loop
ape_recipe=speakWithSelectArray(recipe_list, "前菜 のレシピをえらんでください\n\nぜんさい \nメイン\nデザート")
ape_recipe=ape_recipe*6
ape_taste=speakWithSelectArray(taste, "前菜 の調味料をえらんでください\n\nぜんさい "+all_recipe[ape_recipe][1]+"\nメイン\nデザート")
ape=ape_recipe+ape_taste
a=array2("はい","いいえ")
case speakWithSelectArray(a, "これでよろしいですか?\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  \nデザート ")
when 0 #はい
ape_loop=false
when 1 #いいえ
end #case
end #ape_loop
main_loop=true
while main_loop
main_recipe=speakWithSelectArray(recipe_list, "メイン のレシピをえらんでください\n\nぜんさい "+all_recipe[ape][1]+"\nメイン\nデザート")
main_recipe=(main_recipe)*6
main_taste=speakWithSelectArray(taste, "メイン の調味料をえらんでください\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main_recipe][1]+"\nデザート")
main=main_recipe+main_taste
a=array2("はい","いいえ")
case speakWithSelectArray(a, "これでよろしいですか?\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main][1]+"\nデザート ")
when 0 #はい
main_loop=false
when 1 #いいえ
end #case
end #main_loop
#main=speakWithSelectArray(recipe, "メイン をえらんでください\n\nぜんさい "+recipe[ape]+"\nメイン\nデザート")
#desert=speakWithSelectArray(recipe, "デザート をえらんでください\n\nぜんさい "+recipe[ape]+"\nメイン  "+recipe[main]+"\nデザート ")
desert_loop=true
while desert_loop
desert_recipe=speakWithSelectArray(recipe_list, "デザート のレシピをえらんでください\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main][1]+"\nデザート")
desert_recipe=(desert_recipe)*6
desert_taste=speakWithSelectArray(taste, "デザート の調味料をえらんでください\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main][1]+"\nデザート "+all_recipe[desert_recipe][1]+"")
desert=desert_recipe+desert_taste
a=array2("はい","いいえ")
case speakWithSelectArray(a, "これでよろしいですか?\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main][1]+"\nデザート "+all_recipe[desert][1])
when 0 #はい
desert_loop=false
when 1 #いいえ
end #case
end #desert_loop
a=array2("はい","いいえ")
case speakWithSelectArray(a, "これでよろしいですか?\n\nぜんさい "+all_recipe[ape][1]+"\nメイン  "+all_recipe[main][1]+"\nデザート "+all_recipe[desert][1]+"")
when 0 #はい
loop=false
when 1 #いいえ
end #case
end #loop
#挑戦者のメニューのランダム選出
e_ape=rand(96)
e_main=rand(96)
e_desert=rand(96)
#調理開始
speak("各チーム準備ができたようです")
speak("それでは調理を始めてください")
speak("調理中…")
speak("調理中…")
speak("調理中…")
speak("そこまで!")
#審査
#点数などの変数
score_ape=0
score_main=0
score_desert=0
e_score_ape=0
e_score_main=0
e_score_desert=0
score_t=0
e_score_t=0
ten_time=600
result=0 #-1負け,1勝ち,0引き分け
#審査開始
tile=e_ape+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("まずは挑戦者の前菜です")
speak(all_recipe[e_ape][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
e_score_ape=score
#採点表の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
#次の料理の表示
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
tile=ape+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("続いてチャンピオンの前菜です")
speak(all_recipe[ape][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
score_ape=score
#採点表の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
#次の料理の表示
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
#審査開始
tile=e_main+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("続いて挑戦者のメイン料理です")
speak(all_recipe[e_main][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
e_score_main=score
#採点表の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
#次の料理の表示
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
tile=main+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("続きましてチャンピオンのメイン料理です")
speak(all_recipe[main][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
score_main=score
#採点表の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
#次の料理の表示
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
#審査開始
tile=e_desert+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("続きまして挑戦者のデザートです")
speak(all_recipe[e_desert][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
e_score_desert=score
#採点表の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
#次の料理の表示
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
tile=desert+1
img_d1=tiled(320497,tile,144,80,32,32,4,16) 
img_d2=tiled(320497,tile,208,80,32,32,4,16) 
img_d3=tiled(320497,tile,272,80,32,32,4,16) 
img_d4=tiled(320497,tile,336,80,32,32,4,16) 
speak("最後にチャンピオンのデザートです")
speak(all_recipe[desert][1])
#得点
speak("それでは採点をお願いします")
#一人一人の採点の計算(簡易的にランダム)
score_j1=rand(5)+1
score_j2=rand(5)+1
score_j3=rand(5)+1
score_j4=rand(5)+1
#審査演出
waitTime(ten_time)
img_s1=tiled(320423,score_j1*16,144,16,32,32,4,16)
waitTime(ten_time)
img_s2=tiled(320423,score_j2*16,208,16,32,32,4,16) 
waitTime(ten_time)
img_s3=tiled(320423,score_j3*16,272,16,32,32,4,16) 
waitTime(ten_time)
img_s4=tiled(320423,score_j4*16,336,16,32,32,4,16) 
waitTime(ten_time)
#スコア合計
score=score_j1+score_j2+score_j3+score_j4
if score == 20
s="満点!満点が出ました!"
elsif score > 12
s="これは高得点だ!"
elsif score >8
s="まずまずの点数が出ました"
else
s="あまり高い点数は出ないようです"
end
speak(s)
score_desert=score
#採点表料理の削除
deleteSprite(img_s1)
deleteSprite(img_s2)
deleteSprite(img_s3)
deleteSprite(img_s4)
deleteSprite(img_d1)
deleteSprite(img_d2)
deleteSprite(img_d3)
deleteSprite(img_d4)
drawCanvas()
speak("全ての料理の審査が終わりました")
speak("いよいよ結果発表です!!")
score_t=score_ape+score_main+score_desert
e_score_t=e_score_ape+e_score_main+e_score_desert
#総合得点の発表の演出
#台紙のスプライト
score_L=createSprite(320430)
setSpriteRect(score_L, 0, 0, 96, 96, 0, 0, 96, 96)
setSpritePosition(score_L, 0, 0)
score_R=createSprite(320430)
setSpriteRect(score_R, 0, 0, 96, 96, 0, 0, 96, 96)
setSpritePosition(score_R, 512-90, 0)
drawCanvas()
#得点のテキスト表示
setTextFontColor(0, 0, 0)
setTextFontBold(true)
setTextFontSize(64)
score_L_text=createText(16, 16, 96, 96)
score_R_text=createText(512-96+16, 16, 96, 96)
setText(score_L_text, score_t)
setText(score_R_text, e_score_t)
setTextFontSize(18)
setTextFontBold(false)
setTextFontColor(255, 255, 255)
if score_t > e_score_t #win
result=0
s="勝者はチャンピオンに決定しました!"
elsif score_t < e_score_t #lose
result=1
s="勝者は挑戦者に決定しました!"
else #hikiwake
result=2
s="なんと、この勝負引き分けです!"
end
speak("チャンピオン "+score_t+" 点 挑戦者 "+e_score_t+" 点")
speak(s)
waitTime(1000)
speak("以上で本日の料理対決を終了いたします")
speak("みなさま、またお会いしましょう!")
waitTime(1000)
deleteAllSprite()
deleteTextAll()
drawCanvas()
return result
end
stage=1
case speakWithSelect(2,"する","しない",     "料理対決するかね?")
  when 0 
a= taiketu(stage)
waitTime(1000)
case a
when 0
#speak("勝ったか")
when 1
#speak("負けたか")
when 2
#speak("いい勝負だった")
end
    
  when 1    
end
とくにイベントスクリプトは繰り返しの動作がまとまっていないなど、
見にくいですが、得点計算式ができてから整理しようと思います。
以下自分用データメモ
| 番号 | 名前 | 基 | 肉 | 魚 | 菜 | 卵 | 和 | 洋 | 中 | ビ | 前 | メ | デ | 甘 | 辛 | こ | さ | ゴ | カ | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | オムレツ | ||||||||||||||||||
| 2 | プリン | ||||||||||||||||||
| 3 | だし巻き卵 | ||||||||||||||||||
| 4 | 茶碗蒸し | ||||||||||||||||||
| 5 | キッシュ | ||||||||||||||||||
| 6 | たまごバクダン | ||||||||||||||||||
| 7 | サラダ | ||||||||||||||||||
| 8 | トマトのコンポート | ||||||||||||||||||
| 9 | キャベツ汁 | ||||||||||||||||||
| 10 | きんぴらごぼう | ||||||||||||||||||
| 11 | ポテトサラダ | ||||||||||||||||||
| 12 | ラタトゥイユ | ||||||||||||||||||
| 13 | ブラウンシチュー | ||||||||||||||||||
| 14 | 肉じゃが | ||||||||||||||||||
| 15 | ローストビーフ | ||||||||||||||||||
| 16 | おろしステーキ | ||||||||||||||||||
| 17 | タルタルステーキ | ||||||||||||||||||
| 18 | 蘭州ラーメン | ||||||||||||||||||
| 19 | シューマイ | ||||||||||||||||||
| 20 | ゴマ団子 | ||||||||||||||||||
| 21 | ハンバーグ | ||||||||||||||||||
| 22 | 焼き餃子 | ||||||||||||||||||
| 23 | 春巻き | ||||||||||||||||||
| 24 | 肉詰め唐辛子 | ||||||||||||||||||
| 25 | アクアパッツァ | ||||||||||||||||||
| 26 | おったまケーキ | ||||||||||||||||||
| 27 | サンマの塩焼き | ||||||||||||||||||
| 28 | フィッシューマイ | ||||||||||||||||||
| 29 | ムニエル | ||||||||||||||||||
| 30 | エビチリ | ||||||||||||||||||
| 31 | コンソメスープ | ||||||||||||||||||
| 32 | コーンポタージュ | ||||||||||||||||||
| 33 | 三蛇羹 | ||||||||||||||||||
| 34 | 赤だし | ||||||||||||||||||
| 35 | クラムチャウダー | ||||||||||||||||||
| 36 | トムヤムクン | ||||||||||||||||||
| 37 | 親子丼 | ||||||||||||||||||
| 38 | オムライス | ||||||||||||||||||
| 39 | 焼き鳥 | ||||||||||||||||||
| 40 | 海鮮親子丼 | ||||||||||||||||||
| 41 | 竜田揚げ | ||||||||||||||||||
| 42 | 親子おにぎり | ||||||||||||||||||
| 43 | 闇鍋 | ||||||||||||||||||
| 44 | すき焼き | ||||||||||||||||||
| 45 | 鴨鍋 | ||||||||||||||||||
| 46 | じゃっぱ汁 | ||||||||||||||||||
| 47 | チーズフォンデュ | ||||||||||||||||||
| 48 | 鴛鴦火鍋 | ||||||||||||||||||
| 49 | 湯豆腐 | ||||||||||||||||||
| 50 | 杏仁豆腐 | ||||||||||||||||||
| 51 | たまご豆腐 | ||||||||||||||||||
| 52 | 豆腐味噌汁 | ||||||||||||||||||
| 53 | 豆腐ドーナツ | ||||||||||||||||||
| 54 | 麻婆豆腐 | ||||||||||||||||||
| 55 | もりそば | ||||||||||||||||||
| 56 | アイスラーメン | ||||||||||||||||||
| 57 | 塩ラーメン | ||||||||||||||||||
| 58 | 醤油ラーメン | ||||||||||||||||||
| 59 | 豚骨ラーメン | ||||||||||||||||||
| 60 | 台湾まぜそば | ||||||||||||||||||
| 61 | ペペロンチーノ | ||||||||||||||||||
| 62 | チョコパスタ | ||||||||||||||||||
| 63 | カメパスタ | ||||||||||||||||||
| 64 | イカスミパスタ | ||||||||||||||||||
| 65 | アルフレード | ||||||||||||||||||
| 66 | アラビアータ | ||||||||||||||||||
| 67 | ショートケーキ | ||||||||||||||||||
| 68 | ムーンケーキ | ||||||||||||||||||
| 69 | ケーク・サレ | ||||||||||||||||||
| 70 | お好み焼き | ||||||||||||||||||
| 71 | チーズケーキ | ||||||||||||||||||
| 72 | ビックリパイ | ||||||||||||||||||
| 73 | サンドイッチ | ||||||||||||||||||
| 74 | フレンチトースト | ||||||||||||||||||
| 75 | マルゲリータ | ||||||||||||||||||
| 76 | 照り焼きバーガー | ||||||||||||||||||
| 77 | カツサンド | ||||||||||||||||||
| 78 | グラブラックス | ||||||||||||||||||
| 79 | フルーツ盛り合せ | ||||||||||||||||||
| 80 | 桃包 | ||||||||||||||||||
| 81 | 生ハムメロン | ||||||||||||||||||
| 82 | フルーツ味噌汁 | ||||||||||||||||||
| 83 | アップルパイ | ||||||||||||||||||
| 84 | シナモンアップル | ||||||||||||||||||
| 85 | チャーハン | ||||||||||||||||||
| 86 | ぼた餅 | ||||||||||||||||||
| 87 | ドクドクドリア | ||||||||||||||||||
| 88 | アンアンゾースイ | ||||||||||||||||||
| 89 | リゾット | ||||||||||||||||||
| 90 | パエリア | ||||||||||||||||||
| 91 | ベイクドポテト | ||||||||||||||||||
| 92 | 芋ようかん | ||||||||||||||||||
| 93 | ヴィシソワーズ | ||||||||||||||||||
| 94 | 大学芋 | ||||||||||||||||||
| 95 | コロッケ | ||||||||||||||||||
| 96 | トゥートウロースー | 
コメントする
コメントするには、ログインする必要があります。
コメント一覧
コメントはありません。