So I'm making my final project for my CS class. I'm making a pokemon game.
So right now I'm trying to input information(The pokemon the player has) into my array of objects(The list of pokemon the player has). I have the array in a global class so every form can access it. I have it declared as;
Expand|Select|Wrap|Line Numbers
- public class GlobalVariables
- {
- public static PlayerPokemon[] PlayerPokemonList = new PlayerPokemon[5];
- }
GlobalVariables.PlayerPokemonList[0].Name = "BULBASAUR";
It says the object is null. I've tried to declare the array under the initilizer in the form but it doesn't work, I tried it like this;
Expand|Select|Wrap|Line Numbers
- public IntroForm()
- {
- InitializeComponent();
- GlobalVariables.PlayerPokemonList[] PlayerList = new GlobalVariables.PlayerPokemonList[];
- }
Any help would be greatly appreciated