Skip to content

Commit

Permalink
wormcrawl improvements; set pingpong vs loop as variables.
Browse files Browse the repository at this point in the history
collisions between iTween pathTo and a moving rigidbody are broken.
  • Loading branch information
tyson-kubota committed Mar 25, 2013
1 parent 47f0294 commit 03482c8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion FallingPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ function OnCollisionEnter (collision : Collision) {
isPausable = false;
lifeCountdown.LifeFlashTextureScript.FadeFlash (1, FadeDir.Out);
UIscriptComponent.HideGUI();
yield DeathRespawn ();
//Debug.Log("You died in a fatal collision with " + collision.gameObject);
yield DeathRespawn ();
//isPausable = true;
//UIscriptComponent.UnhideGUI();
}
Expand Down
4 changes: 3 additions & 1 deletion WormCrawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

var pathName : String = "WormLoop";
var crawlTime : int = 15;
var Loop : boolean = false;

function Start () {
iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath(pathName), "looptype", "pingPong", "orienttopath", true, "looktime", 1.0, "lookahead", 0.05, "time", crawlTime, "easetype", "linear"));
if (Loop == true) {iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath(pathName), "looptype", "loop", "orienttopath", true, "looktime", 1.0, "lookahead", 0.05, "time", crawlTime, "easetype", "linear"));}
else {iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath(pathName), "looptype", "pingPong", "orienttopath", true, "looktime", 1.0, "lookahead", 0.05, "time", crawlTime, "easetype", "linear"));}
}

function Update () {
Expand Down
17 changes: 17 additions & 0 deletions WormDeath.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma strict

function Start () {

}

function Update () {
var hit : RaycastHit;
if (Physics.Raycast (transform.position, Vector3.up, hit, 100)) {
//Debug.Log(hit.distance);
if (hit.rigidbody != null && lifeCountdown.isAlive == 1) {
Debug.Log(hit.distance);
lifeCountdown.isAlive = 0;
GetComponent(FallingPlayer).DeathRespawn ();
}
}
}

0 comments on commit 03482c8

Please sign in to comment.