레벨 구성하기
시작하려면 먼저 폴가이즈 스타터(Fall Guys Starter) 섬 템플릿에서 새 프로젝트를 생성합니다. 이 스타터 섬에는 탐색할 수 있는 사전 제작 코스가 포함되어 있으며, 이 튜토리얼에서는 이 코스가 이동하도록 커스터마이징합니다.
이동하는 사물 정의하기
사물을 이동하기 전에 이동 가능한 사물이 무엇인지 정의해야 합니다. Verse 장치를 사용하여 직접 사물을 이동할 수도 있지만, 여러 사물을 한 번에 이동하고 싶다면 이 방법은 까다로울 수 있습니다. 대신 추상 movable_prop 클래스를 정의합니다. 이 클래스에는 이동할 사물 그리고 이동 로직과 타이밍을 커스터마이징하는 데 사용할 몇 가지 다른 값이 포함됩니다.
이동 가능한 사물을 정의하려면 아래 단계를 따릅니다.
Verse 익스플로러(Verse Explorer)를 사용하여 새 Verse 클래스
movable_prop을 생성합니다. 이는 장치가 아닌 Verse 클래스이므로, 빈 템플릿 생성(Create Empty)을 사용하여 이 파일을 생성합니다. 또한 이는 이동 가능한 사물의 다양한 타입을 서브클래스화할 추상 클래스가 되므로, 이 클래스에<abstract>지정자를 추가합니다. Verse에서 새 클래스를 만드는 방법을 알아보려면 Verse 프로그램 처음으로 수정하고 실행하기를 참고하세요.Verse# Defines a Creative prop that moves to a target or location using animation. movable_prop<public> := class<abstract>():using { /Fortnite.com/Devices },using { /Verse.org/Simulation },using { /UnrealEngine.com/Temporary/SpatialMath }임포트 경로를 파일 상단에 추가합니다. 이러한 모듈을 임포트하여 사물을 이동하게 만드는 수학을 처리해야 합니다.이 클래스의 각 필드에는
ToolTip도 포함되어 있습니다. 편집 가능한 필드에ToolTip메시지를 추가하면 UEFN에서 필드 위에 커서를 올릴 때 툴팁이 표시됩니다. 이 클래스에서 사용되는 모든 툴팁은 아래에 나와 있습니다. 이러한 툴팁을 복사해서 붙여 넣어도 되고, 직접 정의해도 됩니다.Verseusing { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/SpatialMath } MoveDurationTip<localizes>:message = "The amount of time the prop takes to move to its destination." MoveEaseTypeTip<localizes>:message = "The animation easing applied to the movement." MoveEndDelayTip<localizes>:message = "The delay after the movement finishes." MoveOnceAndStopTip<localizes>:message = "Whether the RootProp should stop in place after it finishes moving." MoveStartDelayTip<localizes>:message = "The delay before the movement starts." MoveTargetsTip<localizes>:message = "The array of CreativeProp to move toward. These targets can be children of the RootProp."각 이동 가능한 사물에 필요한 필드를 정의합니다.
movable_prop클래스 정의에 다음 필드를 추가합니다.RootProp으로 명명한 편집 가능한creative_prop을 추가합니다. 게임플레이 중에 이동할 포크리 사물입니다.Verse# The Creative prop associated with this class. # This should be the root prop of the object you want to move. @editable {ToolTip := RootPropTip} RootProp:creative_prop = creative_prop{}MoveDuration으로 명명한 편집 가능한float를 추가합니다. 사물이 목적지에 도달하기까지 걸리는 시간입니다.Verse# The duration in seconds it takes for the prop to move to its destination. @editable {ToolTip := MoveDurationTip} MoveDuration:float = 3.0MoveStartDelay로 명명한 편집 가능한float를 추가합니다. 사물이 이동하기 전에 대기하는 시간(초)입니다.Verse# The duration in seconds to wait before movement begins. @editable {ToolTip := MoveStartDelayTip} MoveStartDelay:float = 0.0MoveEndDelay로 명명한 편집 가능한float를 추가합니다. 사물이 이동한 후에 대기하는 시간(초)입니다.Verse# The duration in seconds to wait after movement ends. @editable {ToolTip := MoveEndDelayTip} MoveEndDelay:float = 0.0MoveOnceAndStop으로 명명한 편집 가능한logic을 추가합니다. 사물이 한 번만 이동하는지 또는 이동을 마친 후 반복하는지 여부를 제어합니다.Verse# Whether the RootProp should stop in place when it finishes moving. @editable {ToolTip := MoveOnceAndStopTip} MoveOnceAndStop:logic = falseShouldReset으로 명명한 편집 가능한logic을 추가합니다. 사물이 이동을 마친 후 원래 위치로 리셋되는지 여부를 제어합니다.Verse# Whether the RootProp should reset back to the starting position when it # finishes moving. @editable {ToolTip := ShouldResetTip} ShouldReset:logic = falseStartingTransform으로 명명한 변수 transform을 추가합니다. 이는RootProp이 이동을 시작할 때의 트랜스폼입니다.Verse# The starting transform of the RootProp. var StartingTransform:transform = transform{}
최종 클래스 정의는 다음과 같습니다.
Verseusing { /Fortnite.com/Devices } using { /Fortnite.com/Devices/CreativeAnimation } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/SpatialMath } MoveDurationTip<localizes>:message = "The amount of time in seconds the prop takes to move to its destination." MoveEaseTypeTip<localizes>:message = "The animation easing applied to the movement." MoveEndDelayTip<localizes>:message = "The delay after the movement finishes." MoveOnceAndStopTip<localizes>:message = "Whether the RootProp should stop in place after it finishes moving." MoveStartDelayTip<localizes>:message = "The delay before the movement starts."사물을 이동하기에 앞서 어디에서 이동할지 알아야 합니다. 이를 위해 이동 전에 새 함수를 정의하여
StartingTransform을 설정합니다.새로운 메서드
SetStartingTransform()을movable_prop클래스 정의에 추가합니다.SetStartingTransform()안에서GetTransform()을 사용하여StartingTransform을RootProp의 트랜스폼으로 설정합니다.완성된
SetStartingTransform()함수는 다음과 같습니다.Verse# Sets the StartingTransform to the current transform of the RootProp. SetStartingTransform():void= set StartingTransform = RootProp.GetTransform()
사물 이동을 시작하려면 새 함수
Move()를 다음과 같이 정의해야 합니다.새로운 메서드
Move()를movable_prop클래스 정의에 추가합니다.이 함수가 비동기적으로 실행될 수 있도록
<suspends>모디파이어를 추가합니다. 현재 상태가 이 함수의 베이스 클래스 버전이며 사용되지 않을 것이므로, 즉시return해야 합니다.완성된
Move()함수는 다음과 같습니다.Verse# Move the RootProp to its target. This is the base class # version of this function and should not be used. Move()<suspends>:void= return
사물이 이동을 마칠 때 리셋되도록 하려면 시작 위치로 다시 순간이동시켜야 합니다. 이를 처리하려면 새로운 메서드
Reset()을movable_prop클래스 정의에 다음과 같이 추가해야 합니다.<decides><transacts>모디파이어를 이 함수에 추가하여 리셋이 실패할 경우 롤백을 허용합니다. 사물이 게임플레이 중에 버려진 경우 이러한 상황이 발생할 수 있습니다.Reset()안에서TeleportTo[]를 사용하여RootProp을 다시StartingTransform으로 순간이동시킵니다.완성된
Reset()함수는 다음과 같습니다.Verse# Reset the RootProp by teleporting it back to its Starting Transform. Reset()<decides><transacts>:void= RootProp.TeleportTo[StartingTransform]
여러 함수를 정의했으니, 이제 함수를 모두 연결할 차례입니다. 다양한 이동 함수 전체를 관리하기 위해 새로운 메서드인
ManageMovement()를movable_prop클래스 정의에 추가합니다. 이 함수가 비동기적으로 실행되도록<suspends>모디파이어를 추가합니다.Verse# Loops moving the RootProp to its target by calling Move(), and handles # any logic when the movement begins and ends. ManageMovement()<suspends>:void=ManageMovement()에서 이동을 관리하는loop표현식을 생성합니다. 루프 안에서 먼저MoveStartDelay초 동안Sleep()한 다음Move()를 호출합니다.Verse# Loops moving the RootProp to its target by calling Move(), and handles # any logic when the movement begins and ends. ManageMovement()<suspends>:void= loop: Sleep(MoveStartDelay) Move()플랫폼이 이동을 마치면 계속 이동하거나, 위치를 리셋하거나, 제자리에 멈춰야 합니다. 멈추는 경우를 처리할 수 있도록
if표현식에서MoveOnceAndStop이 true인지 확인합니다. true인 경우 루프를break합니다. 이동을 멈춘 후MoveEndDelay초 동안Sleep()합니다. 마지막으로 다른if표현식에서ShouldReset이 true인지 확인하고 true인 경우Reset[]을 호출합니다. 완성된ManageMovement()함수는 다음과 같습니다.Verse# Loops moving the RootProp to its target by calling Move(), and handles # any logic when the movement begins and ends. ManageMovement()<suspends>:void= loop: Sleep(MoveStartDelay) Move() # If the prop should only move once and stop, then exit the loop. if:이 클래스에는
OnBegin()함수가 없으므로, 다른 클래스가ManageMovement()를 호출하여 플랫폼 이동을 시작하는 방법이 필요합니다. 새 함수Setup()을movable_prop클래스 정의에 추가합니다.Setup()안에서 먼저SetStartingTransform()을 호출한 다음, 플랫폼을 이동시키는ManageMovement()함수를 생성합니다. 완성된Setup()함수는 다음과 같습니다.Verse# Set the StartingTransform, then begin movement by spawning ManageMovement. Setup():void= SetStartingTransform() spawn{ManageMovement()}
다음 순서
추상 클래스가 완성되었으니, 다음 단계에서는 애니메이션을 통해 이동하게 만드는 방법을 알아봅니다.
완성된 코드
이 섹션에서 빌드한 완성된 코드는 다음과 같습니다.
movable_prop.verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
MoveDurationTip<localizes>:message = "The amount of time in seconds the prop takes to move to its destination."
MoveEaseTypeTip<localizes>:message = "The animation easing applied to the movement."
MoveEndDelayTip<localizes>:message = "The delay after the movement finishes."
MoveOnceAndStopTip<localizes>:message = "Whether the RootProp should stop in place after it finishes moving."
MoveStartDelayTip<localizes>:message = "The delay before the movement starts."