Skip to content

Instantly share code, notes, and snippets.

@OutlawGameTools
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OutlawGameTools/ca09ddc98f53e258fb64 to your computer and use it in GitHub Desktop.
Save OutlawGameTools/ca09ddc98f53e258fb64 to your computer and use it in GitHub Desktop.
CS109 - Attach to a coin or other pickup item. Destroys the item and optionally shows a particle effect.
#pragma strict
public var coinEffect : GameObject;
function OnTriggerEnter2D (other : Collider2D)
{
if (coinEffect)
Instantiate(coinEffect, transform.position, transform.rotation);
Destroy(gameObject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment