C
C#•6mo 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
FriteOP•6mo 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•6mo 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
FriteOP•6mo 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•6mo ago
a properly programmed baseclass requires new classes just to add : GameObject
Frite
FriteOP•6mo ago
thats interesting, but i don't know how parent classes works
ACiDCA7
ACiDCA7•6mo ago
well time to learn what inheritance and polymorphism is
Frite
FriteOP•6mo ago
i don't want you to lose more time. Any youtube video or doc about it ?
ACiDCA7
ACiDCA7•6mo ago
sadly no, but i guess others can recommend sources
jalepi
jalepi•6mo 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
FriteOP•6mo ago
Wow so usefull
ACiDCA7
ACiDCA7•6mo ago
sarcasm?
Frite
FriteOP•6mo ago
no at all, i learned a lot of things
ACiDCA7
ACiDCA7•6mo ago
did you learn enough so that you now can solve the initial problem or do you still need some pointers?
Want results from more Discord servers?
Add your server