Hi, I’m holding the stats for my weapons in a 3D array as: [what gun][what level that gun is at][the 6 different stats of that gun]
Here is how I create the array (JS)
var gunStats = [
[[1, 0, 0, .4, 0, .3, 8, 0], [1, 0, 0, .3, 0, .3, 9, 0], [1, 0, 0, .2, 0, .3, 10, 0], [1, 0, 0, .2, 0, .3, 12, 1]], //pistol
[[1, 0, 0, .5, 0, 0, 8, 1], [2, 2, 0, .4, 0, 0, 8, 1], [2, 1, 0, .4, 0, 0, 8, 1], [3, 2, 0, .3, 0, 0, 8, 1]], //rifle
[[1, 6, 0, .25, 0, 0, 10, 0], [1, 5, 0, .2, 0, 0, 10, 0], [1, 3, 0, .18, 0, 0, 10, 0], [1, 2, 0, .15, 0, 0, 10, 0]], //UZI
[[1, 0, 0, 1, 0, 0, 13, 2], [1, 0, 0, 1, 0, 0, 14, 2], [1, 0, 0, .9, 0, 0, 14, 2], [1, 0, 0, .9, 0, 0, 15, 2]], //sniper
[[1, 0.0, 0, 2, 0, 2, 5, 4], [1, 0.0, 0, 1, 0, 1.5, 7, 4], [1, 0.0, 0, 1, 0, 1, 7, 4], [1, 0.0, 0, .8, 0, .8, 8, 4]], //flame thrower
[[4, 3, 0, .2, 0, 1.5, 8, 0], [4, 4, 0, .2, 0, 1.5, 8, 0], [5, 4, 0, .2, 0, 1.5, 8, 0], [5, 5, 0, .2, 0, 1, 8, 0]], //shot gun
[[1, 3, 0, .2, 0, 0, 10, 0], [1, 2, 0, .15, 0, 0, 12, 0], [1, 2, 0, .15, 0, 0, 13, 0], [1, 1, 0, .12, 0, 0, 14, 1]], //assult rifle
[[1, 0.0, 0, 2, 0, 2, 5, 5], [1, 0.0, 0, 1, 0, 1.5, 7, 5], [1, 0.0, 0, 1, 0, 1, 7, 5], [1, 0.0, 0, .8, 0, .8, 8, 5]], //lightning ray gun
[[1, 6, 0, .2, 0, 0, 10, 0], [1, 3, 0, .15, 0, 0, 10, 0], [1, 2, 0, .15, 0, 0, 10, 0], [1, 1, 0, .12, 0, 0, 10, 0]], //AK-47
[[1, 0, 3, .15, 1, .14, 8, 0], [1, 0, 3, .15, 1, .14, 9, 0], [1, 0, 3, .15, 1, .14, 10, 0], [1, 0, 4, .15, 1, .14, 10, 0]], //burst powerful gun
[[1, 0.0, 0, 2, 0, 2, 5, 3], [1, 0.0, 0, 1, 0, 1.5, 7, 3], [1, 0.0, 0, 1, 0, 1, 7, 3], [1, 0.0, 0, .8, 0, .8, 8, 3]], //bazooka
[[1, 0.0, 0, .15, 0.0, 0.0, 10, 0], [1, 0.0, 0, .1, 0.0, 0.0, 10, 0], [1, 0.0, 0, .1, 0.0, 0.0, 13, 1], [01, 0.0, 0, .07, 0.0, 0.0, 13, 1]] //machine gun
];
But later in my code when I try to acess it with
shotsPerFire = gunStats[theGun][currentLevel][0];
I get the following error:
I’m not sure why as it should be an array of floats, not objects.
Help is appreciated, thank you.