This function returns the state of the given Time Source.
time_source_get_state(id);
Argument | Type | Description |
---|---|---|
id | Time Source | The Time Source to get the state of |
if (keyboard_check_pressed(vk_space))
{
var _state = time_source_get_state(time_source);
if (_state == time_source_state_active)
{
time_source_pause(time_source);
}
else if (_state == time_source_state_paused)
{
time_source_start(time_source);
}
}
When the Space key is pressed, this code will get a Time Source's state.
When the state is active, it will pause the Time Source, and when it's paused, it will resume it.