Hi,
I did the 2D Platform Tutorial off of Unity’s website and I want to add coins. What script do I need to use to make the coins disappear and add 1 point to the counter when Leperz or the Space Ship touch them… Thanks!
Hi,
I did the 2D Platform Tutorial off of Unity’s website and I want to add coins. What script do I need to use to make the coins disappear and add 1 point to the counter when Leperz or the Space Ship touch them… Thanks!
I haven’t read that tutorial but I’ve been working on my own 2D top down shooter.
To add coins, your script should just check for a collision with the player. You can then increment a private variable located inside the player script …and its as easy as Destroy(gameObject) to delete the coin
Thanks, but I don’t know what to write to check a collision. Any ideas?
Do this,
OnTriggerEnter(other : Collider){
if(other.CompareTag(“Coin”){
/// Your coin code here
}
}
and set the coin as a trigger