I would like to save some work on my app, is it possible to get the string, for example “level1” and then use the corresponding function, which would be level1();? my main point is not to make a huge switch-case statement, but only make a few level functions in a storage class, and whenever you level up, the string would change to “level” + number where number is the int, so lets say that right now you are in level 10, the function that would run is level10();
I hope i explained it clearly.. sorry if not.. hope you get the idea!
Thanks!
It really sounds like you should just have a
call. That can feel free to ignore (say) levels 11-14 or whatever… but it would be very ugly to have separate methods and invoke them by name. You can do so with reflection, but you should think about other options first.