diff --git a/Characters/player.gd b/Characters/player.gd index 03ffc28..269a71b 100755 --- a/Characters/player.gd +++ b/Characters/player.gd @@ -24,8 +24,11 @@ const CEILING_STICK_SPEED = 20.0 const WALL_STICK_SPEED = 20.0 const SURFACE_SNAP_DISTANCE = 4.0 # Drift off a wall/ceiling by up to this and we pull back on. -# How long to hold before letting go, going over an edge, or hopping. -const HOLD_TIME = 0.5 +# How long to hold before letting go or hopping. +const HOLD_TIME = 0.33 +# How long to hold towards an edge we've stopped at before going over it. +# 0 never stops us at edges at all. +const EDGE_HOLD_TIME = 0.1 # How close an edge must be (from our center) for an edge wrap. const EDGE_SENSOR_RANGE := 12.0 @@ -92,6 +95,9 @@ const BRIDGE_VERTICAL_DOWN_FRAME = 14 const BRIDGE_VERTICAL_UP_FRAME = 15 const BRIDGE_GAP = 32.0 # One tile. const BRIDGE_GAP_TOLERANCE = 1.5 +# How long we show the plain bridge frame after attaching before leaning towards +# the surface we're holding towards. +const BRIDGE_SETTLE_TIME = 0.15 const IN_AIR_FRAME = 8 # The InAir animation's frame. ############### @@ -165,6 +171,7 @@ var timeSpentDroppingFromBridge := 0.0 # Between floor and ceiling, which one we're holding towards: -1 up, 1 down, or 0. # Read by the AnimationTree to lean the column that way. var bridgeLean := 0 +var bridgeSettleTimeLeft := 0.0 # Until this runs out we don't lean (see BRIDGE_SETTLE_TIME). var carriedItem: CarryItem = null # The item riding in our center, or null. Tubes drop it. @@ -647,6 +654,7 @@ func _begin_bridge(normal: Vector2, ownPoint: Vector2, otherPoint: Vector2) -> v # We're still holding away from the surface we left, towards the one across. # Keep holding and we cross over to it after HOLD_TIME, like any other hold. bridgeHoldSide = signf(normal.dot(bridgeAxis)) + bridgeSettleTimeLeft = BRIDGE_SETTLE_TIME _update_bridge_lean() velocity = Vector2.ZERO @@ -697,6 +705,7 @@ func _update_bridge(delta: float, moveInput: Vector2) -> void: else: timeSpentLeavingBridge = 0.0 bridgeHoldSide = side + bridgeSettleTimeLeft = maxf(bridgeSettleTimeLeft - delta, 0.0) var previousLean := bridgeLean _update_bridge_lean() if bridgeLean != previousLean: @@ -719,9 +728,9 @@ func _update_bridge(delta: float, moveInput: Vector2) -> void: # Leans the column towards the surface we're holding towards. The hold side is # along bridgeAxis: -1 left, 1 right between walls; -1 up, 1 down between floor -# and ceiling. +# and ceiling. Straight for a moment after attaching (BRIDGE_SETTLE_TIME). func _update_bridge_lean() -> void: - bridgeLean = int(bridgeHoldSide) + bridgeLean = 0 if bridgeSettleTimeLeft > 0.0 else int(bridgeHoldSide) # Lets go of both surfaces and falls from where we are. @@ -848,7 +857,7 @@ func _find_edge_corner(normal: Vector2, direction: Vector2, reach: float) -> Var return corner -# Stops us with our leading sensor at an edge, until we've held towards it for HOLD_TIME. +# Stops us with our leading sensor at an edge, until we've held towards it for EDGE_HOLD_TIME. func _hold_at_edge(delta: float) -> void: var normal := _get_surface_normal() var tangent := normal.orthogonal() @@ -867,7 +876,7 @@ func _hold_at_edge(delta: float) -> void: timeSpentHoldingEdge = 0.0 return - if timeSpentHoldingEdge >= HOLD_TIME: + if timeSpentHoldingEdge >= EDGE_HOLD_TIME: return timeSpentHoldingEdge += delta