So, for collision I’m passing an arraylist for each thing (creatures, blocks, items), and every time I add a new type of “thing” in the level, I have to add another thing in the constructor for each creature/item/block or whatever it may be.
Since all of these things would be within a given “level”, would it make sense to just pass the instance of the level in the constructor of each object created? That way I can always just get the given arraylists in each level? I know I “could” do this, but I didn’t know if this is really bad regarding memory usage, lag, or something like that. I also didn’t know if this would cause huge delays, and make my game act weird.
Everything works fine the way I’m doing it, but I just noticed that when I want a creature to drop an item on death, I need to add that item to the item arraylist in the level. So I would need to pass that arraylist though the creature… which would create this whole situation. In the end, is it bad to give every object a shortcut (or whatever you wanna call it) of the level?