경로 정밀도 확인 함수
path_get_precision 함수는 주어진 경로가 얼마나 "부드럽게" 처리되었는지를 나타내는 정수 값을 반환합니다. 이 값은 1에서 8 사이의 정수입니다. 직선 경로에 대해 이 값을 얻거나 설정할 수 있지만, 경로 종류가 "부드럽게" 설정되지 않은 경우 인스턴스가 경로를 사용하는 데는 영향을 미치지 않습니다.
문법
path_get_precision(index);
인수
| 인수 | 유형 | 설명 |
|---|---|---|
| index | 정수 | 확인할 경로의 인덱스 |
반환값
- 정수: 경로의 정밀도 값 (1~8)
예제
다음 코드는 "pth_Patrol"에 인덱스가 있는 경로의 종류를 확인하고, 부드러운 경로인 경우 정밀도를 체크하여 8보다 작으면 8로 설정합니다.
if (path_get_kind(pth_Patrol)) {
if (path_get_precision(pth_Patrol) != 8) {
path_set_precision(pth_Patrol, 8);
}
}
활용 예제
- 부드러운 경로 설정
gml var path_index = pth_MyPath; if (path_get_kind(path_index) == path_kind_smooth) { path_set_precision(path_index, 5); } - 정밀도에 따른 경로 조정
gml var current_precision = path_get_precision(pth_Patrol); if (current_precision < 4) { path_set_precision(pth_Patrol, 4); } - 경로 종류에 따른 행동 결정
gml if (path_get_kind(pth_EnemyPath) == path_kind_smooth) { var precision = path_get_precision(pth_EnemyPath); if (precision < 6) { path_set_precision(pth_EnemyPath, 6); } } - 게임 오브젝트의 이동 경로 최적화
gml var path_index = pth_PlayerPath; if (path_get_precision(path_index) < 7) { path_set_precision(path_index, 7); } - 경로 상태 로그 출력
gml var precision = path_get_precision(pth_NPCPath); show_debug_message("Current precision: " + string(precision));
이 함수는 게임에서 경로의 부드러움을 조정하고 최적화하는 데 유용하게 사용될 수 있습니다.