How do I stop a scene from automatically playing?
I have a barnyard scene that will appear as an interactive graphic on a blog post. I want the user to tap on various objects, such as the pig or cow, and each sprite move or makes a sound accordingly. However, I want some objects to trigger the actions of several other objects. Tap the sun in the corner and (since it is dawn), the rooster does its thing, the cow goes moo as it would have if directly tapped upon, and so on. Tap the moon crescent and a set of other actions occur to simulate dusk. I have tried this with Scratch and the interaction is easy enough, but the animation is far from smooth.
Is there a way to broadcast a message (e.g.: onSunUp) that triggers other objects? Or perhaps starts one of several possible timelines?
The basic answer is: you can use an On Scene Load action in the Scene Inspector set to Pause Timeline with the Main Timeline.
To be a bit pedantic on terminology, scenes contain timelines, and those are which play. Every scene has a main timeline which will automatically play when the scene loads. Scene can also contain other timelines you create, which do not autoplay and need to be started by an action.
Therefore in your case the simplest solution may be to not use the Main Timeline at all, since your animations seem fairly independent and would be on separate timelines.
It isn’t clear from your description if you are using Symbols or not.
If you are not using symbols at all, you would create specific animations on alternate timelines, and then create actions to call Start Timeline for those.
If you are using Symbols, then yes, you can create named Custom Behaviors that are set to start the specific timelines in those symbols. You can then use the Trigger Custom Behavior action and enter in the name of that behavior to call it.
One note about Symbols is that they can contain multiple timelines just like Scenes, but also have a Main Timeline. The symbol’s main timeline tends to be used a lot since the point of a symbol itself is to isolate animations, but often they don’t inside the symbol you don’t have the need to run things concurrently. Unlike a scene, a symbol’s main timeline doesn’t inherently autoplay, but Hype will set it up so that it has this behavior. Therefore, if you want to disable autoplaying a Symbol’s main timeline, instead of adding a pause timeline action on symbol load, you can delete the Symbol Action to Start Timeline that is in the Properties area of the symbol element. (If it is a persistent symbol then you would remove the symbol’s On Symbol Load action that is set to start the main timeline).