- Home /
changing variables values !!
Hello guys , i want to ask how i can change more than value in the same time .
function IncreaseSpeed(){
if(MissionDone){
forwardSpeed +=2 ;
backwardSpeed +=2;
sidestepSpeed +=2 ;
}
}
Comment
You question is not very clear, you are indeed changing the value of forwardSpeed, backwardSpeed and sidestepSpeed.
What are the initial values of forwardSpeed, backwardSpeed and sidesstepSpeed
Best Answer
Answer by UNZoOM · Apr 02, 2015 at 03:45 PM
var SpeedArrValues : int[];
function Start()
{
// add forward speed , back speed , sidestepspeed to SpeedArrValues array.
}
function IncreaseSpeed()
{
for( var i : int =0 ; i < SpeedArrValues.length ; i++)
{
SpeedArrValues[i] += 2;
print("Contents"+SpeedArrValues[i]);
}
}
I'm not sure how this answer helps. If anything it slows things down. And don't you have to use SpeedArrValues[0] etc to access the speeds ins$$anonymous$$d of having useful names for them?
To be fair, it's still far from clear what the question means.