Is a state machine what you are looking for? State machines are also covered in the tutorial series, that I linked above. Otherwise you can read about them in the Documentation.
Is a state machine what you are looking for? State machines are also covered in the tutorial series, that I linked above. Otherwise you can read about them in the Documentation.