hi i just finished making a game and i want to make ending credits for it. how do i make them
1 Answer
1Maybe not the best way, but it works. This scrolls credits up the screen. Create an empty GameObject, add a GUIText component, set its Y coordinates below visibility, and this script to it:
var speed = 0.2;
var crawling = false;
function Start()
{
// init text here, more space to work than in the Inspector (but you could do that instead)
var tc = GetComponent(GUIText);
var creds = "Executive Producer:
Mr. Moneybags
";
creds += "Art Director:
Art Guy
";
creds += "Technical Director:
John Yaya
";
creds += "Programming:
Poindexter Kopnik
";
creds += "Level Design:
Randy Bugger
";
... etc ... creds += "Copyright 2011 Worlds Greatest Game Co"; tc.text= creds; }
function Update ()
{
if (!crawling)
return;
transform.Translate(Vector3.up * Time.deltaTime * speed);
if (gameObject.transform.position.y > .8)
{
crawling = false;
}
}
You may need to adjust to your needs. To start credits, just set 'crawling = true'
You can adjust the Rect coords in Update() or OnGUI(). Just declare a variable like 'speed=1.0;' at the top of the script, then in Update(), set each Rect's top component to top+Time.deltaTime*speed; (untested, you may need to tweak this a little). I may be able to post some code later.
– DaveADaveA - On line 6, why do you use "gameObject.transform.position" instead of simply "transform.position"? I'm just starting out, so I'm wondering if there is some best practices reason. Thanks!
– Mike_H