C
C#2mo ago
unluqy

level system

im pretty new to c sharp so excuse me for not being hte best technically but i was thinking of different ways to implement a level system and was confused on which to use? at first i wanted to try use an interface of ILevels as each level will have maxgems / a maxtiemr but these values will be different for each level but i cant assign variables in an interface so would i just make a class of levels? and make attributes?
4 Replies
Omnissiah
Omnissiah2mo ago
you should probably explain more what you have in mind, but essentially code would follow your structure so if you make a clear plan of how you want the stuff to be and the code should pretty much follow
unluqy
unluqyOP2mo ago
so in my game, each level is called a "day" there will be 5 total days and day 1 begins with a small amount of bombs and gems, each bomb loses a life toward the player, and i was thinking to just implement this with a Random function but each day also has a MaxGems and MaxBombs number so it does generate TOO many, as the days progress these numbers get higher for the bombs and the timer also is deducted at the start of each day, i want the days to have the same class since they have the same attributes but each day will have a different value for each attribute? if that makes sense?
Omnissiah
Omnissiah2mo ago
oh ok i thought you mean level as in player level, instead you mean level as map so yes it makes sense BUT in games usually there is a great need for customization, so the general tendency is to use composition instead of inheritance which means that instead of having your level class inheriting an interface with that properties you would have a class implementing them and the level class just contains a field of that class/behavior if you are sure the game will remain simple enough i would see no real issue just using inheritance, if you think it will be 'upgraded' the i would think about using composition
unluqy
unluqyOP2mo ago
ohh okay thanks so much (:
Want results from more Discord servers?
Add your server