I'm working on a text-based game as a practice project.
I already managed to write an engine that displays information and handles user input. It draws the games content from custom Scene
classes. More precisely, I have a Scene
superclass and create child-classes, like EvilDungeon extends Scene
, for the actual playable levels.
All scenes are located in a "Scenes"-folder, but I want to be able to make game expansions later on by dropping additional .class files of new scenes into said folder.
My plan was to use loadClass
when the game is started to add them to a Scene
-array, but it requires the class names which I can't know, since there can a any random combination of scenes in the Scenes-folder.
How can I load all scenes in the folder without knowing which scenes exactly are present? Can I retrieve the class name somehow?