lunar lander

i;m trying to do a 3d lunar lander game and i.m having problems with the movemt script its moving the lander but not tilting it and the trust part of the script is not working the i’m intending it to so any help would be good but heres the link to the test level to look at so you can see whats going wrong

HTML Code:
http://3dsplanet.co.uk/gamestesterspage/WebPlayer.html
and the keys are arrow keys to move and enter for thust

I’d suggest adding more upward force to the object to get it off the ground.

var style : GUIStyle;
var fuel : float = 100.0;
var fuelDeduct = 2.0;  // reduce 2 each second == 10 every 5 sec

function Update ()
{
    if(Input.GetKey("enter"))
    {
        fuel -= fuelDeduct * Time.deltaTime;
    }
}

function OnGUI()
{     
    GUI.Label(Rect(250, 120, 100, 20), fuel.ToString("f0"), style);
}

i.m trying to get this fuel script to work with texture’s or the gui so it looks like it going down in a life bar style any suggestions would be great

here’s a link to the online testing page but just a warning not all the scripts are working right as i’m still debugging the scripts so the test game is not responding as it should as yet lol

http://http://3dsplanet.co.uk/gamestesterspage/luner%20lander.html

Make an image with a bar full and one with an empty bar and display it that way.

Use the google custom search engine in my .sig to look for things. I searched for health bar, and I got this:

There are other solutions as well!

i got this fuel script which i’m trying to get a pickup to add fuel but its not working right can any one help us out

var barDisplay : float = 0
;

var pos : Vector2 = new Vector2(20,40);

var size : Vector2 = new Vector2(60,20);

var progressBarEmpty : Texture2D;

var progressBarFull : Texture2D;

 

function OnGUI()

{

 

    // draw the background:

    GUI.BeginGroup (new Rect (pos.x, pos.y, size.x , size.y));

        GUI.Box (Rect (0,0, size.x, size.y),progressBarEmpty);

 

        // draw the filled-in part:

        GUI.BeginGroup (new Rect (0, 0, size.x * barDisplay, size.y));

            GUI.Box (Rect (0,0, size.x, size.y),progressBarFull);

        GUI.EndGroup ();

 

    GUI.EndGroup ();

 

} 

 

function Update()

{   

if(Input.GetKey("up"))

    {

    // for this example, the bar display is linked to the current time,

    // however you would set this value based on your desired display

    // eg, the loading progress, the player's health, or whatever.

    barDisplay = Time.time * 0.003;}

}

function OnTriggerEnter (other : Collider) {
    if (other.gameObject.tag == "Pickup"){
       other.gameObject.active = false;
       barDisplay -= 1;}
    /*working progress---->
     if (other.gameObject.tag == "trap"){
       other.gameObject.active = false;
       count += 1;}*/
	
}

I would approach this in a way that keeps my data and my display separate.

I would have one set of code that keeps track of my fuel consumption/replacement, and another bit of code that displays my current fuel value. When my fuel value drops to zero, my code stops my control over the ship and the UI displays that I’m out of fuel.

var burnRate;   // Amount of fuel burned per second.
var maxFuel : float;   // The amount of fuel you start with (could be called startingFuel or whatever).
var addFuel : float;   // The amount of fuel your pickups carry (could be set to vary or be random).
private var currentFuel : float;   // Current fuel value.
private var canThrust : boolean;   // The flag to test if you can fly your ship.

function Awake () {
   currentFuel = maxFuel;
   canThrust = true;
}

function Update () {
   if (Input.GetButtonDown "Thrust") {
      fuel -= burnRate * Time.deltaTime;   // This is framerate independent! (Or burn per second, rather than burn per frame...)
      // This code only keeps track of burning fuel.
      // You will need your own code for creating thrust to fly your ship.
   }

   if (fuel <= 0  canThrust) {
      canThrust = false;
      // Stop thrusting! You need to tie this into your code to fly your ship.
      // This is not Game Over until you hit the ground and blow up - who knows? You could land on a pickup and survive.
   }
}

function OnGUI () {
   // Code that displays currentFuel/MaxFuel in whatever UI way you'd like: Progress Bar, Circle, Text...
   // Code that displays "Out of Fuel!" when fuel is <= zero.
}

function OnTriggerEnter () {
   if (other.gameObject.tag == "Pickup") {
      // other.gameObject.active = false; <-- This is depreciated in 4.0
      other.gameObject.SetActive (false);
      AddFuel ();   // Separate this out into its own function for control and clarity
   }
}

function AddFuel () {
   currentFuel += addFuel;
   currentFuel = Mathf.Clamp (currentFuel, 0, maxFuel);   // Clamp the value so you don't get more fuel than maxFuel!
}