Use LIST to store random animations for scene items

Hi @demetere,

The play animation CoBlock doesn’t take variables. So if you want to play random animations from the list, you can use TypeScript:

let objects = [“Casual girl”, “Casual boy”];
let animation = [“Run”, “Skip”];

let objName = objects[Math.floor(Math.random()*objects.length)];
let animationName = animation[Math.floor(Math.random()*animation.length )];

(Scene.getItem(objName) as AnimatedItem).animation.play(animationName)

Feel free to remix this example and explore the code:
https://cospac.es/X4C5

1 Like