|Name of gadget||Timer|
|Section||Logic & Processing|
|Number of Tweak pages||1|
|Last updated||24 Feb 2019 [Beta]|
This gadget provides you with a timer, stopwatch, and pulse generator. You can use it to delay an event, run an event for a set time, calculate time taken for an event to occur, and create a score. It is very versatile. It generates a pulse signal when the timer reaches a predetermined count. You can create a loop with it so you can create a pulse signal at a given interval. This is particularly useful in conjunction with the randomiser. In edit mode, the gadget itself has a progress bar on it to indicate its current position.
Example Tutorial (adapted from Media Molecule)
- Stamp a cube.
- Snap a grab sensor to it.
- Tweak the cube so that imp interaction is set to grab.
- Nudge the glow slider to 40%.
- Stamp a timer.
- Connect the timer finished (signal) output to the glow slider input on your cube.
- Connect the grabbed output on the grab sensor to the start timer input.
- Go to test mode.
- Grab the shape then let go.
- The shape will glow for 5 seconds then stop.
- Target Time
This is the length of time the timer will run for. Depending on the mode this will be what the timer counts up to or down from. The default is a count up to 5 seconds.
- Current time
This allows you to read or change the current time count
- Timer Type
- Count Up
This setting makes the timer count up to the target amount
This setting allows for the timer to run at different speeds depending on the strength of the input signal to 4a. This is useful if you want the player or an event to be able to delay the timer for a duration.
This uses the input signal strength of 4a to determine a proportion of the timer target time to reach before it is regarded as finished. So a 40% signal will allow the timer to count up to 40% of its target time before it stops.
- Count Down
This setting makes the timer count down from the target amount to zero.
- Count Up
- Start Timer
Wire a signal here to start the timer. Its signal strength can change the way the timer works depending on timer type selected. Note that a timer without anything wired into this input will start as soon as the scene starts.
- Timer finished (pulse)
This sends out a pulse to say the timer has reached either the target amount or zero or percentage of target amount (depending on the mode)
- Reset Timer
This sets the timer back to the start (either zero or the target amount, depending on the mode). Wire the Timer finished (pulse) to the reset input to get a loop. There is no need to wait until the timer is finished – it will take effect as soon as a new signal is sent to this input regardless of the timer’s position.
- Timer Output
This produces an output that is the current time as a percentage of the target time. So with a target of 6 seconds, and the current time at 3 seconds, the output will be 50. You can use this to gradually change a slider as the time moves towards completion such as a light coming on.
- Timer finished (signal)
This sends a continuous signal of 1 when the timer has reached either the target amount , percentage of target amount or zero (depending on the mode)
This is where you turn the gadget on/off