time_source_get_period 함수 설명
time_source_get_period
함수는 주어진 시간 소스에 대해 설정된 주기 값을 반환합니다. 이 주기 값은 시간 소스에 설정된 단위(초 또는 프레임)로 표현됩니다.
문법
time_source_get_period(id);
인수
인수 | 유형 | 설명 |
---|---|---|
id | Time Source ID | 주기 값을 가져올 시간 소스 |
반환 값
반환 값 | 유형 | 설명 |
---|---|---|
Real | 실수 | 시간 소스의 주기 값 |
활용 예제
예제 1: 기본 사용
var period = time_source_get_period(my_time_source);
show_message("주기 값: " + string(period));
예제 2: 주기 값에 따라 행동 결정
var period = time_source_get_period(my_time_source);
if (period > 60) {
// 1분 이상일 경우
show_message("주기가 1분 이상입니다.");
} else {
// 1분 이하일 경우
show_message("주기가 1분 이하입니다.");
}
예제 3: 여러 시간 소스의 주기 값 출력
for (var i = 0; i < array_length(time_sources); i++) {
var period = time_source_get_period(time_sources[i]);
show_message("시간 소스 " + string(i) + "의 주기: " + string(period));
}
예제 4: 주기 값에 따른 애니메이션 속도 조절
var period = time_source_get_period(my_time_source);
animation_speed = 1 / period; // 주기에 따라 애니메이션 속도 조절
이와 같이 time_source_get_period
함수를 활용하여 다양한 기능을 구현할 수 있습니다.