Skip to content

Instantly share code, notes, and snippets.

@bricef
Last active August 29, 2015 14:05
Show Gist options
  • Save bricef/0354eac6025a04a24b83 to your computer and use it in GitHub Desktop.
Save bricef/0354eac6025a04a24b83 to your computer and use it in GitHub Desktop.
#pragma strict
var damage = 20;
var vel = Vector2(0,10);
var boom : AudioClip;
function Start () {
rigidbody2D.velocity = vel;
}
function Update () {
}
function OnCollisionEnter2D(col : Collision2D){
var target = col.gameObject.GetComponent(IDamagable);
if(target){
Destroy(collider);
renderer.enabled = false;
target.Damage(30.0);
audio.PlayOneShot(boom);
}
Invoke("Nuke", boom.length);
}
function Nuke(){ Destroy(gameObject); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment