Skip to content

Commit

Permalink
Update BirdJump.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaewon0702 authored Nov 11, 2022
1 parent d2e48f4 commit 1c56d6b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Movement/BirdJump.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections; //python의 import == using
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class BirdJump : MonoBehaviour
{
Expand All @@ -18,8 +19,16 @@ void Update()
{
if(Input.GetMouseButtonDown(0))
{
GetComponent<AudioSource>().Play(); // 점프할 때마다 소리 출력
rb.velocity = Vector2.up * jumpPower; //(0,1)*3, Vector3면 3차원(x,y,z), 3만큼 힘을 받아서 점프

}
}

private void OnCollisionEnter2D(Collision2D other) { //물체가 서로 부딪혔을 때 {}안의 내용을 실행
if(Score.score > Score.bestScore){
Score.bestScore = Score.score;
}
SceneManager.LoadScene("GameOverScene"); // 새가 물체에 부딪혀서 GameOverScene으로 전환
}
}

0 comments on commit 1c56d6b

Please sign in to comment.