#pragma strict

var boom: AudioClip;
var track: AudioSource;
var shotTimer: int = 300;
var maxForce;
var score;
var scoreText: GUIText;
var projSpawn: Transform;
var Cannonball: Rigidbody2D;
var proj: Rigidbody2D;
var projj: GameObject;
var animator: Animator;
var fatty: GameObject;
var an: AnimScript2;

function Start () {
Invoke (“FixedUpdate”, 15);
animator = GetComponent(“Animator”);
fatty = gameObject.Find(“ballrinagame_0″);
an = fatty.GetComponent(AnimScript2);
}

function FixedUpdate () {

if(shotTimer > 0){
shotTimer -= Time.deltaTime;
}

if(shotTimer <= 0 && an.transform.position.x < 83.53967){

var proj: Rigidbody2D = Instantiate(Cannonball, projSpawn.position, projSpawn.rotation);

proj.velocity = Vector2(-150,0);
proj.AddForce(Vector2(-300,100));
animator.SetTrigger(“Fire”);
audio.PlayOneShot(boom);
shotTimer = 300;
}

}

function Update () {

}

About the author

    Leave a Reply

    Your email address will not be published.

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>