Last active
August 29, 2015 14:16
-
-
Save OutlawGameTools/44e0a066caf33d8522c9 to your computer and use it in GitHub Desktop.
CS109 - Destroy the game object when clicked on. Game object must have a collider component.
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 | |
function OnMouseDown () | |
{ | |
if (gameObject.transform.position.y > -2 && gameObject.transform.position.y < 4) | |
{ | |
GameData.numGrabbed++; | |
GameData.DisplayScore(); | |
Destroy(gameObject); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment