Construct2で2Dゲームを作る(48)

メッセージウィンドウの続き。

  • Add event → System → On start of layout
  • Add action → System → Set layer visible → Layer: “Popup”,Visibility: Invisible
  • このイベントの全体を選択し、Events の一番上へ(一番上までドラッグ)

続いて、ライフをグローバル変数に修正します。

  • Event sheet の余白を右クリック → Add global variable → Name: PlayerLife, Type: Number, Initial value: 5
  • 敵に衝突した時の “Subtract 1 from life” を削除(複数あるよ!)
  • 代わりに “Subtract 1 from PlayerLife” を作成し、削除したところに入れる
  • “bird life < 0” (の右側)を右クリックして Replace condition
  • System → Compare variable →  Variable: PlayerLife, Comparison: ≦ Less or equal, Value: 0
  • レイアウト上でbirdを選択、Properties → Instance variables から
    Life を削除しておく

Leave a Reply

Your email address will not be published. Required fields are marked *