Created
March 12, 2015 10:35
-
-
Save OutlawGameTools/eaead48ff8e02023df70 to your computer and use it in GitHub Desktop.
CS109 - Attached to a ship, kills itself and instantiates an explosion when it hits a trigger2d collider.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
public var expl : GameObject; | |
function OnTriggerEnter2D (other : Collider2D) | |
{ | |
var newPos : Vector3 = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, 0); | |
Instantiate(expl, newPos, Quaternion.identity); | |
Destroy(gameObject); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment