첨부 파일
스켈레탈 애니메이션 스프라이트는 "슬롯"을 가질 수 있으며, 여기에는 "첨부 파일"을 배치할 수 있습니다. 첨부 파일은 스프라이트가 소품으로 사용할 수 있는 단순한 이미지로, 슬롯에 배치되어 해당 슬롯이 위치한 부분의 애니메이션과 함께 움직입니다. 예를 들어, 전사 스프라이트의 손에 첨부 파일 슬롯이 있다고 상상해 보세요. 이 슬롯에 다양한 무기 스프라이트를 배치하면 전사가 검, 창, 방패 등을 사용하는 것처럼 보이게 할 수 있습니다.
이 섹션에서는 첨부 파일과 그 스프라이트에 대해 구체적으로 다루지만, 슬롯을 설정하고 슬롯에 대한 정보를 얻는 함수는 슬롯 페이지를 참조하면 됩니다.
사용 가능한 첨부 파일 함수
| 함수 이름 | 설명 |
|---|---|
| skeleton_attachment_get | 첨부 파일 정보를 가져옵니다. |
| skeleton_attachment_set | 첨부 파일을 설정합니다. |
| skeleton_attachment_exists | 첨부 파일이 존재하는지 확인합니다. |
| skeleton_attachment_create | 새로운 첨부 파일을 생성합니다. |
| skeleton_attachment_create_colour | 색상을 가진 새로운 첨부 파일을 생성합니다. |
| skeleton_attachment_replace | 기존 첨부 파일을 교체합니다. |
| skeleton_attachment_replace_colour | 색상을 가진 기존 첨부 파일을 교체합니다. |
| skeleton_attachment_destroy | 첨부 파일을 삭제합니다. |
활용 예제
예제 1: 전사 스프라이트에 무기 첨부하기
// 전사 스프라이트에 검 첨부
var weapon = skeleton_attachment_create("sword");
skeleton_attachment_set(skeleton, "hand_slot", weapon);
예제 2: 방패로 교체하기
// 손 슬롯에 방패로 교체
var shield = skeleton_attachment_create("shield");
skeleton_attachment_replace(skeleton, "hand_slot", shield);
예제 3: 첨부 파일 색상 변경하기
// 첨부 파일 색상 변경
skeleton_attachment_replace_colour(skeleton, "hand_slot", "red");
예제 4: 첨부 파일 삭제하기
// 손 슬롯의 첨부 파일 삭제
skeleton_attachment_destroy(skeleton, "hand_slot");
예제 5: 첨부 파일 존재 여부 확인하기
// 손 슬롯에 첨부 파일이 있는지 확인
if (skeleton_attachment_exists(skeleton, "hand_slot")) {
// 첨부 파일이 존재함
}
이와 같은 방식으로 스켈레탈 애니메이션 스프라이트의 슬롯에 다양한 첨부 파일을 추가하고 관리할 수 있습니다.