There are several approaches. Which one is best depends on the context.
-
Scripts: A simple scene management: finally a good use of scripts
-
Separate Rule: Design Pattern: Separation of Behaviors (this is Kim’s suggestion)
-
Lambdas: Reusable Functions: A simple lambda example with copious notes (rossko57’s suggestion)