I apologise, I know this question has been asked a thousand times before by C# beginners (of which I am one), but all the answers I can find say I need to either instantiate the class, or make it static. My class is instantiated, and I am trying to access the instance. Can anyone take a look at my code and work out what is going wrong?
public class RocketSimMain {
public RocketShip test = new RocketShip ();
public static void Main() {
... // Do some setup stuff here
//Run the game loop
while (!EndGameRequested()) {
test.Move(); <- Object instance error here.
}
}
}
As you can see, I'm instantiating the class and accessing the instance. The only thing that works is instantiating the class inside the Main method, but then I'm not able to access it in other classes.