Arrays and Index
Posted: Thu Jan 13, 2011 8:45 pm
Hello everybody!
For a part of my game I need to calculate a sort of interest for the player's borrowings.
Each time the player borrows money interest is calculated. For each frame he pays a little interest. As he keeps on borrowing, I need to calculate
the interest for his aggregated borrowing. The player always borrows the same amount and never pays it back (except by refinancing). Actually, this
is not too important.
I created an array that stores the information on which frame he borrowed. Each time the player collides with the money the frame is stored.
//fcount counts the frames, a is an index
Another text actor is supposed to display the latest frame (for testing)
The text actor does not display the value of the InterestFrames array.
If I put
textNumber = InterestFrames[1];
the text actor displays the value (true for any number of the array)
=> Why does "InterestFrames[1]" work while "InterestFrames[1]" does not?
Thanks for your help.
I attached a file.
For a part of my game I need to calculate a sort of interest for the player's borrowings.
Each time the player borrows money interest is calculated. For each frame he pays a little interest. As he keeps on borrowing, I need to calculate
the interest for his aggregated borrowing. The player always borrows the same amount and never pays it back (except by refinancing). Actually, this
is not too important.
I created an array that stores the information on which frame he borrowed. Each time the player collides with the money the frame is stored.
- Code: Select all
InterestFrames[a] = fcount;
a = a + 1;
//fcount counts the frames, a is an index
Another text actor is supposed to display the latest frame (for testing)
- Code: Select all
textNumber = InterestFrames[a];
The text actor does not display the value of the InterestFrames array.
If I put
textNumber = InterestFrames[1];
the text actor displays the value (true for any number of the array)
=> Why does "InterestFrames[1]" work while "InterestFrames[1]" does not?
Thanks for your help.
I attached a file.