Timelines offer you a way to create and control instances and actions over a set time period.

In most games you will want certain things to happen at certain moments in time. Now, you can try to achieve this by using the alarm events but when things get too complicated this won't work any more, especially as you are limited to only twelve alarms. That's why we have the time line resource.

In a time line you specify which actions must happen at certain moments in game time, and you can use all the actions that are also available for an object in its different events. Once you create a time line you can then assign it to an object, and the instance of that object will then execute the actions at the indicated moments of time when placed or created within a room. Let us explain this with an example:

Assume you want to make a guard and that this guard should move 20 time steps to the left, then 10 upwards, then 20 to the right, then 10 downwards and then finally stop. To achieve this you can make a time line where you start with setting a motion to the left. You would then create moment 20 (a "moment" is just another way of saying "step") and set a motion upward, then at moment 30 a motion to the right, at moment 50 a motion downwards and finally at moment 60 you would stop the motion. Once that is done, you can assign this time line to the guard and the guard will do exactly what you planned. You could even set an alarm in the time line so that it is repeated after a certain length of time and in this way your guard can patrol an area!

You can also use a time line to control your game more globally. Create an invisible controller object, create a time line that at certain moments creates enemies, and then assign it to the controller object. Once you start to work with it you will find out it is a very powerful tool indeed!

Creating A Timeline

To create a time line, choose Create Time Line from the Resources menu, or right click on the time line resource in the resource tree and select Create Time Line or you can just click on the create a time line icon found on the resource toolbar at the top of the main screen. Whatever method you choose will open the following window:

It's very similar to the object properties window as you can specify a name for your time line (like all resources, this should be specific and unique), and with an action list and actions on the right, and there is even a Show Information button that can be used to get an overview of all actions within the time line. However, on the left, instead of an event list we have a moment list. In a time line a moment is the same as a step, so ten moments on your time line are the same as ten steps in your game, and you can insert any number of actions and/or code into one moment and the object that has the time line assigned to it will carry out these actions at the required time. Note that the time line can be started at any time in-game, so moment 0 is just the moment in which the time line starts and not the moment the game or room starts.

The following buttons are available in this window to enable you to add, remove and change moments within the time line resource that you have created:

Please note, that although it is possible to create negative time moments, it is pointless to do so as they will never be executed!

Back: Advanced Use Index
Next: Scripts
© Copyright YoYo Games Ltd. 2015 All Rights Reserved