前提・実現したいこと
フラッピーバード的なゲームを作成しています。
上下の壁をくぐり抜け,透明なオブジェクトに当たるとTextに数字が+1される機能を実装していますがうまくいきません。
該当のソースコード
C#
1using UnityEngine; 2using System.Collections; 3using UnityEngine.UI; 4using UnityEngine.SceneManagement; 5 6public class PlayerScript : MonoBehaviour { 7 public static int score = 0; 8 public Text ScoreText; 9 10 void Update () { 11 this.transform.Rotate (new Vector3 (0, 0, -14 * Time.deltaTime)); //ここの行は関係ない。 12 ScoreText.text = "Score:" + score.ToString (); 13 14 if (Input.GetMouseButtonDown (0)) { 15 GetComponent<Rigidbody2D> ().velocity = new Vector3 (0,4,0); 16 } 17 } 18 19 20 void OnTrrigerExit (Collider other) { 21 score++; 22 } 23} 24
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/05/30 10:24
2018/05/30 11:22
退会済みユーザー
2018/05/30 13:06
2018/05/31 04:57