Space message added

This commit is contained in:
2023-01-17 05:54:14 +05:30
parent 58e9ea33ba
commit 652134f007
2 changed files with 87 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ using UnityEngine;
public class Player : MonoBehaviour
{
public GameObject StartPanel;
public Color[] pogeColors;
[SerializeField]private Transform body;
[field:SerializeField]public Vector2 Velocity {get; private set;}
@@ -35,6 +36,7 @@ public class Player : MonoBehaviour
[SerializeField]private Rigidbody2D playerRigidbody;
void Start(){
StartPanel.SetActive(true);
spriteRenderer = GetComponent<SpriteRenderer>();
timeAliveMoney = GetComponent<TimeAliveMoney>();
isAlive = true;
@@ -52,9 +54,8 @@ public class Player : MonoBehaviour
}
int lastX = 0;
void FixedUpdate()
{
if(Input.GetKey(KeyCode.X)){
DataManager.total = 5000000;
{if(Input.GetKey(KeyCode.Space)){
Jump();
}
if (!gameStarted)
@@ -65,9 +66,7 @@ public class Player : MonoBehaviour
if(!isAlive){ return; }
HandleDeath();
if(Input.GetKey(KeyCode.Space)){
Jump();
}
HandleJump();
if(lastX != (int)body.position.x){
@@ -107,6 +106,7 @@ public class Player : MonoBehaviour
if (!gameStarted)
{
gameStarted = true;
StartPanel.SetActive(false);
playerRigidbody.bodyType = RigidbodyType2D.Dynamic;
playerRigidbody.gravityScale = gravity;
}