Code keeps entering values into array backwards
So I have this code, where I'm trying to figure out how many forground
layers will be in a map :
int layerNum=5 //in the current map it has 5 layers
int index = 3 //in the current map
fgLayers = new int[layerNum - (index + 1)];
for (int x = 0; x < fgLayers.length; x++) {
fgLayers[x] = layerNum - x - 1;
Gdx.app.log(ChromeGame.LOG, fgLayers[x] + "");
}
However, it puts the values into the fgLayers array backwards so instead
of 3,4 it would 4,3. I need it to be in the right order because each layer
has certain images on it, which look improper when placed in a different
order.
Unfortunately, I cannot see where I'm going wrond in this piece of code, I
tried switching where it starts of at in the for loop (starts at
fgLayers.length, ends at 0) but that didnt work either.
Saturday, August 10, 2013
Code keeps entering values into array backwards
Posted on 10:50 PM by Unknown
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment