- Home /
Question by
uanmanarmy · Aug 05, 2014 at 01:18 PM ·
floatintconversioncast
Cannot implicitly convert type `float' to `int
where is the int ?
public float[,] board;
public float GridHeight;
public float GridWidth;
The error is here
board = new float[GridWidth,GridHeight]
Comment
The problem was that I'm so stupid. As Paulo Henrique said bellow, you can't make an array from float values.
Imagine an array with 2.3432323424234232, How this Could be ? :d
Best Answer
Answer by Paulo-Henrique025 · Aug 05, 2014 at 01:24 PM
You are trying to create an Array with a float size, can you imagine an array sized "2.36666"? It is just not possible.
public float[,] board;
public int GridHeight;
public int GridWidth;
Just changing GridHeight and GridWidth to INT will solve it.