C
C#•3w ago
Frite

How to iterate all classes in a name space ?

Hi, thank you for your time. Another name space MonoGame is using the name space GameName as showed on the picture. My idea is that MonoGame take each class in GameName and runs the code in it. is it possible ? also bonus question : how a program can ignore the fact that something doesn't exist ?
No description
13 Replies
Frite
Frite•3w ago
I fact, i want to make my own little engine based on monogame but i don't realy know the right way to do it.
ACiDCA7
ACiDCA7•3w ago
ooof you chose quite the project for being a beginner... have the classes inherit from a baseclass usually called gameobject that provides a baseline for you classes.. then put all instances in a list and interate over them
Frite
Frite•3w ago
yep, but i don't want to do it each time i create a new script. Wouldn't there be something to auto-reference objects ?
ACiDCA7
ACiDCA7•3w ago
a properly programmed baseclass requires new classes just to add : GameObject
Frite
Frite•3w ago
thats interesting, but i don't know how parent classes works
ACiDCA7
ACiDCA7•3w ago
well time to learn what inheritance and polymorphism is
Frite
Frite•3w ago
i don't want you to lose more time. Any youtube video or doc about it ?
ACiDCA7
ACiDCA7•3w ago
sadly no, but i guess others can recommend sources
jalepi
jalepi•3w ago
Microsoft Visual C# Step by Step, 10th Edition, or newer. Read the book, doing the exercises for each chapter. Proceed to the next chapter once you understood the previous one. Don't skip. One by one, like a good student 😉
Frite
Frite•3w ago
Wow so usefull
ACiDCA7
ACiDCA7•3w ago
sarcasm?
Frite
Frite•3w ago
no at all, i learned a lot of things
ACiDCA7
ACiDCA7•3w ago
did you learn enough so that you now can solve the initial problem or do you still need some pointers?