How does one refer to the game1 class's variables in XNA
Posted
by
user1149068
on Stack Overflow
See other posts from Stack Overflow
or by user1149068
Published on 2012-03-28T05:07:46Z
Indexed on
2012/03/28
5:29 UTC
Read the original article
Hit count: 193
I try to refer to an array in the Game1 class by creating an object of the Game1 class with its definition Game1 gameObject;
, its declaration gameObject = new Game1();
in the constructor, and its usage gameObject.tileArray[xInt, yInt].treed = true;
.
The game1 class itself remains unchanged in its class code other than some methods and variables. When I try to use this code in the TreeRegion class it gives me "Object reference not set to an instance of an object," leading me to believe that the game1 class is null somehow.
How might one change the class or object in order to refer to game1's variables? Mind you I am self-taught and still rather new to C#.
The class that refers to game1: http://pastebin.com/0chEcKfq Game1 itself http://pastebin.com/zLDVzCca
© Stack Overflow or respective owner