system
December 10, 2011, 6:40pm
1
Here is the script.
//The Sprint script
if (Input.GetButtonDown("Shift")) {
maxForwardSpeed = maxSprintSpeed ;
maxSidewaysSpeed = maxSprintSpeed ;
maxBackwardSpeed = 0 ;
}
if (Input.GetButtonUp("Shift")) {
maxForwardSpeed : float = 20.0;
maxSidewaysSpeed : float = 20.0
maxBackwardsSpeed : float = 10.0
Any help will be very apreciated. Ty
BiG
December 10, 2011, 7:18pm
2
The errors seem clear to me, and they are evident. the last two lines need “;” at the end. The second “if” doesn’t have the close bracket “}”.
Durante
December 10, 2011, 7:22pm
3
I agree with BIG having read your errors that is exactly what needs to be done. close off the last two lines with the " ; " and then close of the argument with a " } "…and you should be good to go.
Durante
December 10, 2011, 7:40pm
4
This is how your code should look
var maxForwardSpeed : float = 20.0;
var maxSidewaysSpeed : float = 20.0;
var maxBackwardsSpeed : float = 10.0;
var maxSprintSpeed : float = 30.0;
if (Input.GetButtonDown("Shift"))
{
maxForwardSpeed = maxSprintSpeed ;
maxSidewaysSpeed = maxSprintSpeed ;
maxBackwardSpeed = 0 ;
}
if (Input.GetButtonUp("Shift"))
{
maxForwardSpeed = maxForwardSpeed;
maxSidewaysSpeed = maxSidewaysSpeed;
maxBackwardsSpeed = maxBackwardsSpeed;
}
thats the basic setup for your char to run as far as the walk functions you have to script them out if you havent already.
thank you Durante Productions
Durante
December 16, 2011, 10:41pm
5
here you go i updated it i messed up when i rewrote it sry.
var maxForwardSpeed : float = 20.0;
var maxSidewaysSpeed : float = 20.0;
var maxBackwardsSpeed : float = 10.0;
var maxSprintSpeed : float = 30.0;
if (Input.GetButtonDown("Shift"))
{
maxForwardSpeed = maxSprintSpeed ;
maxSidewaysSpeed = maxSprintSpeed ;
maxBackwardSpeed = 0 ;
}
if (Input.GetButtonUp("Shift"))
{
maxForwardSpeed = maxForwardSpeed;
maxSidewaysSpeed = maxSidewaysSpeed;
maxBackwardsSpeed = 0;
maxSprintSpeed = 0;
}
I hope this helps.