- Home /
Question by
cabowabo4000 · Nov 09, 2014 at 04:56 PM ·
javascriptplayertexttime
Move Up Text If Other Is Present And Move Down When Gone.
I'm trying to get the text that appears above my players head to move aside if another text is triggered for a text that is also above my players head.
Right Now It Will Only Mash Together With My Other Texts
This Is What Im Trying To Get.
And If I Pick Up Another Item:
And Then When The First Text Goes Away The Second (Newest) Will Move Down To The Firsts Spot.
JS only please.
var ItemPickup : GameObject; var ClothingAdd : GameObject; var DescriptionCloth : TextMesh; var timer = 6.0; var starttimer=false; static public var ItemNumber = 0; var LocalItemNumber= 0; //SET ITEM NUMBER IN INSPERCTOR!
function Update ()
{
if(starttimer==true)
{
timer=timer-Time.deltaTime;
}
if(timer <= 0)
{
DescriptionCloth.renderer.enabled=false;
}
}
function OnCollisionEnter2D (collided : Collision2D)
{
if(collided.gameObject.tag=="Player")
{
ItemPickup.renderer.enabled=false;
ItemPickup.collider2D.enabled=false;
DontDestroyOnLoad (this);
DescriptionCloth.renderer.enabled=true;
starttimer=true;
DescriptionCloth.renderer.enabled=true;
ClothingKeep.Enabled=true;
DontDestroyOnLoad (this);
ItemNumber=LocalItemNumber;
Debug.Log(LocalItemNumber);
}
if(collided.gameObject.tag=="Description")
{
DescriptionCloth.transform.Translate(0,5,0);
}
}
untitled.png
(21.4 kB)
untitled3.png
(23.1 kB)
Comment
Your answer
