Here a sample showing how to create a class function of characters which animations can be parameterized. Here their movements hang on their speed.