JS:
var runspeed : float;//for example runspeed =12
var walkspeed : float;//for example walkspeed =8
var maxjumpHeight: float;//for example maxjumpHeight =10
function Update () {
speed = 12;
walkspeed = 8:
maxjumpHeight = 10;
if ( runspeed > 12){
Application.Quit();
}
if ( walkspeed > 9){
Application.Quit();
}
if ( speed > 10){
maxjumpHeight.Quit();
}
}
By the way this is driving me crazy....
Code:
/**
* Fixed: globals with camel case
* plus there is no declaration var name : float in JS
*/
var runSpeed = 12;
var walkSpeed = 8;
var maxJumpHeight = 10;
/**
* update
* Checks the current value of the speed variables
* If they are greater than the max allowed, kill the application.
*/
function update() {
/**
* Removed this code because setting the speed (supposed to be runspeed),
* walkspeed, and maxjumpHeight here would negate the checks as you just
* overwrote the current value.
*/
//speed = 12;
//walkspeed = 8:
//maxjumpHeight = 10;
if ( runSpeed > 12){
Application.Quit();
}
if ( walkSpeed > 9){
Application.Quit();
}
/**
* Fixed reference to speed to maxJumpHeight
* Fixed maxjumpHeight.Quit(); to Application.Quit();
*/
if ( maxJumpHeight > 10){
Application.Quit();
}
}