Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //****** Donations are greatly appreciated. ******
- //****** You can donate directly to Jesse through paypal at https://www.paypal.me/JEtzler ******
- //----------------------------------------------------------------------
- //Main Combat Text Script
- //----------------------------------------------------------------------
- private var scroll: float = 0.08; // scrolling velocity private var duration: float = 1.5; // time to die private var alpha: float;
- private var alpha : float = 4.00;
- private var duration : float = 1.50;
- function Start(){
- guiText.material.color = Color(1,1,1,1.0);
- alpha = 1;
- }
- function Update(){
- if (alpha>0){
- transform.position.y += scroll*Time.deltaTime;
- alpha -= Time.deltaTime/duration;
- guiText.material.color.a = alpha;
- }
- else {
- Destroy(transform.gameObject);
- }
- }
- //----------------------------------------------------------------------
- //Other script to call combat text
- //----------------------------------------------------------------------
- var ptsPrefab: Transform; // drag the prefab to this variable in Inspector
- function spawnPts(points: float, x: float, y: float){
- x = Mathf.Clamp(x,0.05,0.95); // clamp position to screen to ensure
- y = Mathf.Clamp(y,0.05,0.9); // the string will be visible
- var gui: Transform = Instantiate(ptsPrefab,Vector3(x,y,0),Quaternion.identity);
- gui.guiText.text = points.ToString();
- gui.guiText.material.color = Color(1,1,1,1.0);
- }
- //----------------------------------------------------------------------
- //last piece of code to call function
- //----------------------------------------------------------------------
- spawnPts(100,0.3,0.4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement