i'm making small game in xna @ moment.
and want base size of array on screen's resolution.
i did this:
public const int intboardheight = (graphicsadapter.defaultadapter.currentdisplaymode.height -150) / 10 ; public const int intboardwidth = (graphicsadapter.defaultadapter.currentdisplaymode.width - 200) / 10; public bool[,] gameboard = new bool[intboardheight,intboardwidth]; public bool[,] gameboardupdate = new bool[intboardheight, intboardwidth]; public int[,] gameboardint = new int[intboardheight, intboardwidth];
but gives me error "the expression being assigned 'game_of_life_2.game1.intboardheight' must constant".
so, how base constant on variable?
thanks in advance!
simon.
edit: guys! worked well!
you can't. make public static readonly int
Comments
Post a Comment