此函数启动给定的时间源,将其状态更改为 time_source_state_active。
指定的时间源可能是从未启动、暂停、停止或过期且没有重复的新时间源。
此函数将"软重置"给定的时间源,并将其过期时间和剩余代表重置为为其配置的值。
time_source_start(id);
参数 | 类型 | 描述 |
---|---|---|
id | Time Source | 要启动的时间源 |
N/A
var _my_method = function()
{
instance_destroy();
}
var _time_source = time_source_create(time_source_game, 300, time_source_units_frames, _my_method);
time_source_start(_time_source);
在本例中,我们希望实例在 300 帧后自行销毁。
代码首先创建一个只调用 instance_destroy() 的方法。
然后创建时间源,从游戏时间源继承。它将其周期设置为 300 帧。
最后,启动时间源。