Improved on wall dynamics.

This commit is contained in:
genxium 2023-02-04 18:33:49 +08:00
parent 680e4f1f59
commit 917fca2bcd
5 changed files with 19 additions and 14 deletions

View File

@ -547,7 +547,7 @@
"array": [ "array": [
0, 0,
0, 0,
209.73151519075364, 210.27555739078596,
0, 0,
0, 0,
0, 0,
@ -2313,7 +2313,7 @@
"mapNode": { "mapNode": {
"__id__": 3 "__id__": 3
}, },
"speed": 5000, "speed": 500,
"_id": "76ImpM7XtPSbiLHDXdsJa+" "_id": "76ImpM7XtPSbiLHDXdsJa+"
}, },
{ {

View File

@ -8,7 +8,7 @@ cc.Class({
}, },
speed: { speed: {
type: cc.Float, type: cc.Float,
default: 500 default: 100
}, },
}, },

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"ver": "1.0.5", "ver": "1.0.5",
"uuid": "40edd08e-316c-44b8-a50f-bd173554c554", "uuid": "22e2b0ab-1350-4f5e-9960-f2b45b0bf353",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,

View File

@ -23,13 +23,14 @@ const (
GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases GRAVITY_Y = -int32(float64(0.5) * WORLD_TO_VIRTUAL_GRID_RATIO) // makes all "playerCollider.Y" a multiple of 0.5 in all cases
INPUT_DELAY_FRAMES = int32(6) // in the count of render frames INPUT_DELAY_FRAMES = int32(6) // in the count of render frames
INPUT_SCALE_FRAMES = uint32(2) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames) INPUT_SCALE_FRAMES = uint32(1) // inputDelayedAndScaledFrameId = ((originalFrameId - InputDelayFrames) >> InputScaleFrames)
SP_ATK_LOOKUP_FRAMES = int32(5) SP_ATK_LOOKUP_FRAMES = int32(5)
SNAP_INTO_PLATFORM_OVERLAP = float64(0.1) SNAP_INTO_PLATFORM_OVERLAP = float64(0.1)
SNAP_INTO_PLATFORM_THRESHOLD = float64(0.5) SNAP_INTO_PLATFORM_THRESHOLD = float64(0.5)
VERTICAL_PLATFORM_THRESHOLD = float64(0.9) VERTICAL_PLATFORM_THRESHOLD = float64(0.9)
MAGIC_FRAMES_TO_BE_ONWALL = int32(12)
NO_SKILL = -1 NO_SKILL = -1
NO_SKILL_HIT = -1 NO_SKILL_HIT = -1
@ -939,11 +940,6 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
break break
} }
} }
if !currPlayerDownsync.OnWall && thatPlayerInNextFrame.OnWall {
// To avoid mysterious climbing up the wall after sticking on it
thatPlayerInNextFrame.VelY = 0
}
} }
} }
if !thatPlayerInNextFrame.OnWall { if !thatPlayerInNextFrame.OnWall {
@ -1071,9 +1067,7 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
oldNextCharacterState := thatPlayerInNextFrame.CharacterState oldNextCharacterState := thatPlayerInNextFrame.CharacterState
switch oldNextCharacterState { switch oldNextCharacterState {
case ATK_CHARACTER_STATE_IDLE1, ATK_CHARACTER_STATE_WALKING, ATK_CHARACTER_STATE_TURNAROUND: case ATK_CHARACTER_STATE_IDLE1, ATK_CHARACTER_STATE_WALKING, ATK_CHARACTER_STATE_TURNAROUND:
if thatPlayerInNextFrame.OnWall { if jumpedOrNotList[i] || ATK_CHARACTER_STATE_INAIR_IDLE1_BY_JUMP == currPlayerDownsync.CharacterState {
thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_ONWALL
} else if jumpedOrNotList[i] || ATK_CHARACTER_STATE_INAIR_IDLE1_BY_JUMP == currPlayerDownsync.CharacterState {
thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_INAIR_IDLE1_BY_JUMP thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_INAIR_IDLE1_BY_JUMP
} else { } else {
thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_INAIR_IDLE1_NO_JUMP thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_INAIR_IDLE1_NO_JUMP
@ -1086,6 +1080,17 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer
} }
} }
if thatPlayerInNextFrame.OnWall {
switch thatPlayerInNextFrame.CharacterState {
case ATK_CHARACTER_STATE_WALKING, ATK_CHARACTER_STATE_INAIR_IDLE1_BY_JUMP, ATK_CHARACTER_STATE_INAIR_IDLE1_NO_JUMP:
hasBeenOnWallChState := (ATK_CHARACTER_STATE_ONWALL == currPlayerDownsync.CharacterState)
hasBeenOnWallCollisionResultForSameChState := (currPlayerDownsync.OnWall && MAGIC_FRAMES_TO_BE_ONWALL <= thatPlayerInNextFrame.FramesInChState)
if hasBeenOnWallChState || hasBeenOnWallCollisionResultForSameChState {
thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_ONWALL
}
}
}
// Reset "FramesInChState" if "CharacterState" is changed // Reset "FramesInChState" if "CharacterState" is changed
if thatPlayerInNextFrame.CharacterState != currPlayerDownsync.CharacterState { if thatPlayerInNextFrame.CharacterState != currPlayerDownsync.CharacterState {
thatPlayerInNextFrame.FramesInChState = 0 thatPlayerInNextFrame.FramesInChState = 0