-
내일배움캠프 38일차 TIL - 다시 사이드 프로젝트에 집중하기Misc/오늘 알아낸 것 2023. 9. 14. 21:57
오늘은 사이드 프로젝트에서 전투에서 쓸 데이터 구조를 만들었다
대략 구조는
스킬 (공통된 데이터가 다 들어가있음, 위력, 대상, 대미지 타입, 리소스 태그등)
그걸 가지고 있는
플레이어 카드 데이터
플레이어가 해당 스킬을 사용하기 위해 필요한 구조 (코스트, 카드 등급등이 들어가있음)
에너미 패턴 데이터
적이 해당 스킬을 사용하기 위해 필요한 구조 (시전 시간, 패턴 속성 타입등이 들어가있음)
이런 식으로 구조를 만든뒤 전투를 구현해봤는데
전에 만들었던 프로젝트보다 되게 유연하고 코드도 엄청 짧아지게 되었다
그리고 튜플을 사용하여 데미지 판정 코드를 더 간결하게 작성도 해봤다
코드가 짧아져서 행복한 하루였다
'Misc > 오늘 알아낸 것' 카테고리의 다른 글
내일배움캠프 40일차 TIL - 스테이지 데이터 구상하기 (0) 2023.09.16 내일배움캠프 39일차 TIL - 오늘도 사이드 프로젝트 했다 (0) 2023.09.15 내일배움캠프 34일차 TIL - 오늘 느낀 점 (0) 2023.09.10 내일배움캠프 33일차 TIL - 오늘 느낀 점 (1) 2023.09.09 내일배움캠프 30일차 TIL - 오늘은 캐릭터 기획을 했다 (0) 2023.09.06