채팅0

    마법사 분기 이동(쿼터무브) 스크립트

    조회수 754

    local LeftShift_pressed = false


    return function (self, event)


       local key = self:RedirectKey(event.key)
       if (key == KeyboardKey.DownArrow) then
           self.SystemInputs[_FuncKeySystemType.Down] = true
       elseif (key == KeyboardKey.UpArrow) then
           self.SystemInputs[_FuncKeySystemType.Up] = true
       elseif (key == KeyboardKey.LeftArrow) then
           self.SystemInputs[_FuncKeySystemType.Left] = true
       elseif (key == KeyboardKey.RightArrow) then
           self.SystemInputs[_FuncKeySystemType.Right] = true
       elseif (key == KeyboardKey.Escape) then
           self.SystemInputs[_FuncKeySystemType.Esc] = true
       else
           -- Your existing code for handling other keys

           -- ...

           if LeftShift_pressed then
               LeftShift_pressed = false
           end
       end

       if KeyboardKey.X == key then -- 텔 단축키
           LeftShift_pressed = true
       elseif LeftShift_pressed then
           local currentPosition = _UserService.LocalPlayer.TransformComponent.WorldPosition
           local newXPosition, newYPosition

           if KeyboardKey.RightArrow == key then
               newXPosition = currentPosition.x + tpxy
               newYPosition = currentPosition.y + tpxy
           elseif KeyboardKey.LeftArrow == key then
               newXPosition = currentPosition.x - tpxy
               newYPosition = currentPosition.y + tpxy
           elseif KeyboardKey.UpArrow == key then
               newXPosition = currentPosition.x - tpxy
               newYPosition = currentPosition.y - tpxy
           elseif KeyboardKey.DownArrow == key then
               newXPosition = currentPosition.x + tpxy
               newYPosition = currentPosition.y - tpxy
           end

           local newPosition = Vector2(newXPosition, newYPosition)
           _UserService.LocalPlayer.MovementComponent:SetWorldPosition(newPosition)
       end

       -- Your existing code for handling other keys

       -- ...
    end

    댓글4

    회원프로필

    2024.03.11 01:56
    회원프로필

    이 스크립트를 어디에 추가하는걸까요?

    2024.03.11 05:42
    회원프로필

    어느 스크립트에 추가하면 되는걸까요..?

    2024.03.11 10:33
    회원프로필

    이대로 하니까 키 먹통이던데 다른 방법이 있나용? ㅠㅠ

    2024.03.11 15:02