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
머건들면될까용
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 26951 | 02-02 | 272 | ||
| 26950 | 02-02 | 279 | ||
| 26949 | 02-02 | 493 | ||
| 26948 | 02-02 | 369 | ||
| 26947 | 02-02 | 550 | ||
| 26946 | 02-02 | 266 | ||
| 26945 | 02-02 | 758 | ||
| 26944 | 02-02 | 684 | ||
| 26943 | 02-02 | 488 | ||
| 26942 | 02-02 | 482 | ||
| 26941 | 02-02 | 212 | ||
| 26940 | 02-02 | 287 | ||
| 26939 | 02-02 | 203 | ||
| 26938 | 02-02 | 460 | ||
| 26937 | 02-02 | 342 | ||
| 26936 | 스크류바 형님꺼+7 | 02-02 | 473 | |
| 26935 | 02-02 | 215 | ||
| 26934 | 02-02 | 1036 | ||
| 26933 | 02-02 | 399 | ||
| 26932 | 02-02 | 871 |
댓글2
챗gpt 한테 물어봐도 그건 알려줌
의적 뽀로로형 그냥한번알려주라 ..