Bee Trip (minimalistic code)

Posted by (twitter: @alchymi)
April 28th, 2013 11:42 am

beetripHOME

My game’s main script is minimalistic too

 

var path : Transform[];
var value : float;
var travelSpeedDivider:float;
public var isPlaying:boolean;
var Alive:boolean;
var explosion:GameObject;
var explosion2:GameObject;
var Bee:Transform;
var GuiRef:GameObject;

function Start(){
Alive=false;
}

function Update(){

if(Alive){
if(Input.GetKey(“space”) || Input.touchCount == 1){

}else{
!!
value+=Time.deltaTime/travelSpeedDivider;
if(value>=1){
travelSpeedDivider-=2;
if(travelSpeedDivider<6){
travelSpeedDivider=6;
}
value=0;
}
iTween.PutOnPath(gameObject,path,value);
transform.LookAt(iTween.PointOnPath(path,value+.05));
}
}
}

function OnTriggerEnter(collision : Collider) {

if(Alive){
Instantiate(explosion,transform.position,Quaternion.identity);
Instantiate(explosion2,transform.position,Quaternion.identity);
delayedRestart();
}
Alive=false;
Bee.active=false;
}

function delayedStart(){
yield WaitForSeconds(3);
Alive=true;
}

function delayedRestart(){
yield WaitForSeconds(5);
Application.LoadLevel (0);
}


Leave a Reply

You must be logged in to post a comment.

[cache: storing page]