Quantcast
Channel: Answers for "Array index confusion - what does [i-1] do exactly???"
Browsing latest articles
Browse All 8 View Live

Answer by Jessy

In short, array[i - i] gives you the value of the element at the index 1 less than i.Your code does not generate those values. It either generates 40-160, or just 40, for index 1-4 in gearSpeeds. You...

View Article



Answer by RSud

your first time through the loop there is no value set for gearSpeeds[0] since the if statement skips setting gearSpeed[0]. I guess this is a good thing since if it didn't you first time through you...

View Article

Answer by ronronmx

Jessy, you're right there's something else going on in the code. Here's the full function below: var topSpeed : float = 160; var numberOfGears : int = 5; private var gearSpeeds : float[]; function...

View Article

Answer by ginryu

um, first off, you implementation is off. gear speed is based on a gear ration, you make a varible, or an array and make it float[] then set the index to 2 then you make a variable called gear ratio,...

View Article
Browsing latest articles
Browse All 8 View Live




Latest Images