Simple scripting help (86913)

I want to restart the level if my player’s speed is less than 5.9.
I tried this code, but it didn’t work. Any help?

var runSpeed : float = 5.9;

function Update()
{
if (float < runSpeed)
{
Application.LoadLevel("Level1");
}
}

I’m a noob at scripting so I was hoping you to help me with this :slight_smile:

1 Answer

1

Don’t get me wrong but you are in the wrong place. You need to learn programming first or making a game will not be as fun as it should.

Your error here is that float is not a variable, it is a type:

var runSpeed : float = 5.9;
var speed :float = 10;
 
function Update()
{
   if (speed < runSpeed)
   {
      Application.LoadLevel("Level1");
   }
}