Showing animations on-screen with slices

From OHRRPGCE-Wiki
Jump to navigation Jump to search

The easiest way (I think) to do this is to create a select slice.

A select slice shows only 1 of its children at a time.

Go ahead and create a new collection with a select slice. Add child slices that you want to use in the animation. You can see that only 1 child is visible at a time. If you want to show lots of slices at once, put it all in a container slice, and make that the child of the select slice instead.

Now you need to write a script to load this select slice, and to cause it to cycle through its children. It might look like this:

    • Load slice collection (this will display the slice on-screen, but it won't be animated)
    • Set select slice index (this will cause the select slice to change the visible child.)
    • Wait (this pauses the animation for as many ticks as you'd like to display the current child)
    • Set select slice index (now you should choose the next child to be displayed)

Using "set select slice index" you can change the visible child of the select slice, and using "wait" you can display it on-screen for as many ticks as you'd like. When you are finished with the animation, make sure to "free slice" to remove it.

If you want to call this animation repeatedly, you should give its own script with a name, so that you can call it wherever and whenever.

You probably noticed that the animation plays somewhere on the screen, probably in the top-left-hand corner. If you want it to play at a certain location, you need to place the select slice with "put slice" after you load it. You also probably noticed that the position of the slice is based around the top-left-hand corner of its box. You can change its alignment and anchor settings in the slice editor, or you can use plotscripting commands such as "center slice" to change it so that the animation appears centered over the location you put it.