I am working on making a game where each level has different mechanics, but I want to keep all the input handling, rendering, etc in one place. My approach is to have a Level class with all the needed methods, then each level is its own class (Intro, BossRoom, etc) that extends Level and override methods to change the parts that need to change for each without having to copy over all of the contents of Level for each class.
I have a LevelManager class that will hold all of the reference to the levels, and I was wanting to use ArrayList to do this.
I've tried using ArrayList<Level>, ArrayList<?>, ArrayList<? extends Level>, and ArrayList<? instanceof Level> both when I declare and instantiate the variable. Nothing I've tried seems to work. Is there something is Java that does this or should I just have each Level as a variable?
Sorry for block of text, I'm new to SO and do not know a better way to word it.
List<Level>? What issues does that cause?