Quantcast
Channel: Questions in topic: "tips"
Viewing all articles
Browse latest Browse all 102

Trying to get Player Tip for player to open on Return and close on Return

$
0
0
Hi everyone, just trying to get this issue sorted. So I have a sign board that when the player clicks return a tip will pop up (i.e. "space to jump") and I want it so the player can just press enter again to close it. But if I try that, the menu opens and closes at the same time which is slightly annoying, any ideas? private GameObject player; private GameObject Tip1; private GameObject Tip2; private GameObject Canvas; private GameObject TipObject; private PlayerController playerScript; public bool InTrigger = false; public bool TipShowing = false; // Use this for initialization void Start () { player = GameObject.FindGameObjectWithTag("Player"); Tip1 = GameObject.Find("TipPoint"); Tip2 = GameObject.Find("TipPoint2"); Tip1.SetActive(true); Tip2.SetActive(false); Canvas = GameObject.Find("WorldCanvas"); Canvas.SetActive(false); TipObject = GameObject.Find("TipObject"); TipObject.SetActive(false); playerScript = player.GetComponent(); } void Update() { if(Input.GetKeyDown(KeyCode.Return) && (InTrigger == true && TipShowing == false)) { playerScript.CanMove = false; Debug.Log("Enter"); TipObject.SetActive(true); Canvas.SetActive(false); TipShowing = true; } if (Input.GetKeyDown(KeyCode.Return) && InTrigger == true && TipShowing == true) { Debug.Log("Enter2"); playerScript.CanMove = true; TipObject.SetActive(false); Canvas.SetActive(true); TipShowing = false; } } void OnTriggerEnter2D(Collider2D other) { if(other.gameObject.tag == "Player") { Tip1.SetActive(false); Tip2.SetActive(true); Canvas.SetActive(true); InTrigger = true; }

Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>