Enhanced inertia handling.

This commit is contained in:
genxium 2023-02-05 11:27:26 +08:00
parent d38d4b4ec9
commit d25bb5ff10
5 changed files with 11 additions and 7 deletions

View File

@ -539,7 +539,7 @@
"array": [
0,
0,
210.16474188040044,
209.6693197428241,
0,
0,
0,
@ -2360,7 +2360,7 @@
"mapNode": {
"__id__": 3
},
"speed": 5000,
"speed": 500,
"_id": "76ImpM7XtPSbiLHDXdsJa+"
},
{

View File

@ -461,7 +461,7 @@
"array": [
0,
0,
209.73151519075364,
209.6693197428241,
0,
0,
0,

View File

@ -547,7 +547,7 @@
"array": [
0,
0,
210.27555739078596,
209.6693197428241,
0,
0,
0,

File diff suppressed because one or more lines are too long

View File

@ -652,10 +652,12 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
*/
alignedWithInertia := true
exactTurningAround := false
if 0 == effDx && 0 != thatPlayerInNextFrame.VelX {
stoppingFromWalking := false
if 0 != effDx && 0 == thatPlayerInNextFrame.VelX {
alignedWithInertia = false
} else if 0 != effDx && 0 == thatPlayerInNextFrame.VelX {
} else if 0 == effDx && 0 != thatPlayerInNextFrame.VelX {
alignedWithInertia = false
stoppingFromWalking = true
} else if 0 > effDx*thatPlayerInNextFrame.VelX {
alignedWithInertia = false
exactTurningAround = true
@ -672,6 +674,8 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
if exactTurningAround {
thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_TURNAROUND
thatPlayerInNextFrame.FramesToRecover = chConfig.InertiaFramesToRecover
} else if stoppingFromWalking {
thatPlayerInNextFrame.FramesToRecover = chConfig.InertiaFramesToRecover
} else {
thatPlayerInNextFrame.FramesToRecover = (chConfig.InertiaFramesToRecover >> 1)
}