Let's take a look at the code again to make sure we are on the same page.
The code for Collectable.cs is as follows:
using UnityEngine; using System.Collections; public class Collectable : MonoBehaviour { bool isCollected = false; void Show() { this.GetComponent<SpriteRenderer>().enabled = true; this.GetComponent<CircleCollider2D>().enabled = true; isCollected = false; } void Hide() { this.GetComponent<SpriteRenderer>().enabled = false; this.GetComponent<CircleCollider2D>().enabled = false; } void Collect() { isCollected = true; Hide(); GameManager.instance.CollectedCoin(); } void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { Collect(); } } }
Here is the code for HealthPoint:
...