samedi 29 août 2020

What is common practice for implementing one-off things in code? [closed]

I'm new to programming and have been using tkinter in python to work on a game. This applies to my game but would also probably apply to many other games and programs too.

For example, if I create a dialogue system in a game and for one specific scenario or for the final boss the dialogue is different (For example the font changes, colour changes, the dialogue has a specific animation or requires a choice made by the player etc), what is the best way to implement it?

I could use a switch statement or if statement, to check if it's that specific scenario but it wouldn't be efficient to have the program check the condition every time, would it be? Is there any better practice for doing such code? Or is there a different problem that leads me into this problem?

Aucun commentaire:

Enregistrer un commentaire