zz_y7.fly_dupe = function(mob)
local hitByLeft = false
local knockbackType = 1
local kb = mob.MobKnockbackComponent
local ai = mob.MobAIComponent
local rb = mob.MobRigidbodyComponent
local map = mob.CurrentMap
local boundLt, boundRb = map.MapComponent:GetBound()
local minX = boundLt.x + 0.1
local maxX = boundRb.x - 0.1
local mobPos = mob.TransformComponent.WorldPosition:ToVector2()
local sqrt = math.sqrt
local elapse = 0
local knockbackMoveEnd
local interruptedEnd
if (knockbackType == 2) then
knockbackMoveEnd = 0.5
interruptedEnd = 0.7
else
knockbackMoveEnd = 0.1
interruptedEnd = 0.5
end
local timelines = {}
local timelineIndex = 0
local currentX = mobPos.x
local currentY = mobPos.y
local function makeDistance(x1, y1, x2, y2)
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
end
kb:SetShoeAttr(knockbackType)
local knockbackSpeed = rb.WalkSpeed * _Physics.FlySpeed / 1
---@param destX number
---@param destY number
---@param floating boolean
---@return number
local function makeFlyCommand(cmd, destX, destY, floating)
local distance = makeDistance(currentX, currentY, destX, destY)
currentX = destX
currentY = destY
local duration = distance / knockbackSpeed
timelines[timelineIndex + 1] = {cmd, {destX, destY, duration, floating}, 0}
timelineIndex += 1
return duration
end
local function makeCommand(cmd, value, nextTime)
timelines[timelineIndex + 1] = {cmd, value, nextTime}
timelineIndex += 1
end
local inputX = 1
if (hitByLeft) then
inputX = -1
end
-- makeCommand(_MobActionPartType.HitMotion, 1, 0)
local knockbackDestX = mobPos.x
local delta = knockbackSpeed * knockbackMoveEnd
if (inputX < 0) then
knockbackDestX = math.max(minX, mobPos.x - delta)
else
knockbackDestX = math.min(maxX, _UserService.LocalPlayer.TransformComponent.WorldPosition.x + 0.8)
end
if (mobPos.x ~= knockbackDestX) then
mobPos.y += 0.02
-- makeCommand(_MobActionPartType.KnockbackPos, mobPos, 0)
makeFlyCommand(_MobActionPartType.KnockbackFly, knockbackDestX, _UserService.LocalPlayer.TransformComponent.WorldPosition.y , false)
end
-- makeCommand(_MobActionPartType.HitMotion, 0, interruptedEnd)
if (timelineIndex > 0) then
map.LifeControllerComponent:RequestControl(mob, timelines, timelineIndex, true)
endend
머건들면될까용
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 공지 | 게시판 이용 안내+156 | 10-20 | 22377 | |
| 61790 | 12-26 | 291 | ||
| 61789 | 12-25 | 400 | ||
| 61788 | 12-25 | 392 | ||
| 61787 | 12-24 | 671 | ||
| 61786 | 12-23 | 965 | ||
| 61785 | 12-22 | 1010 | ||
| 61784 | 12-22 | 1125 | ||
| 61783 | 12-22 | 994 | ||
| 61782 | 12-21 | 1076 | ||
| 61781 | 12-21 | 1231 | ||
| 61780 | 12-21 | 1155 | ||
| 61779 | 12-19 | 1352 | ||
| 61778 | 12-18 | 1453 | ||
| 61777 | 12-18 | 2013 | ||
| 61776 | 12-16 | 1958 | ||
| 61775 | 12-14 | 2058 | ||
| 61774 | 12-14 | 2427 | ||
| 61773 | 12-14 | 2316 | ||
| 61772 | 12-13 | 2179 |
댓글2
챗gpt 한테 물어봐도 그건 알려줌
의적 뽀로로형 그냥한번알려주라 ..