So, I’m very new to C# (about two weeks) and I’ve reached a point in my borrowed textbook about Arrays and such.
The examples where pretty clear, but the uses were less so.
If I were to, for example, make a pokemon style game… would I be right to try the following?
Use an Array named “Pokemon” with a range of 150 to handle the initial instance of each pokemon?
Use a struct with variables such as “HP” “Move1” “Move2” “Attack” etc, with values that can be adjusted by the Pokemon array when a Pokemon is needed in battle?
Or should I use an Enum to handle what I thought the Array should do?
This is just an example to help me equate these concepts into something I’d understand better, I’m not looking to rip off pokemon at all.
For enums, think of them as a way to list different values with words rather than just numbers. For example:
Then, a Pokemon class, representing a single Pokemon:
Thus, you can create Pokemon objects:
The core element of C# (and object oriented programming) is modelizing your data so that it fits in objects which are portable and changeable. Meaning that you can add all sorts of other properties (I went a bit quickly with this), such as HP, Moves, etc.
To create an array:
Then you need to set each one: