diff --git a/src/playerD/Player.tscn b/src/playerD/Player.tscn index 6dacee8..cbf46ec 100644 --- a/src/playerD/Player.tscn +++ b/src/playerD/Player.tscn @@ -593,6 +593,7 @@ attack_node = NodePath("../attack") [node name="jump" type="Node" parent="movement_state_machine" index="3"] script = ExtResource( 8 ) move_speed = 90.0 +move_modifier_move_acceleration = -100.0 animation_sequence = [ "jump" ] idle_node = NodePath("../idle") fall_node = NodePath("../fall") diff --git a/src/playerD/states/jump.gd b/src/playerD/states/jump.gd index 8e82eaa..2012508 100644 --- a/src/playerD/states/jump.gd +++ b/src/playerD/states/jump.gd @@ -21,10 +21,6 @@ func enter() -> void: # if modifier_stack_ref.has(landing_mod): # print("Jump from Landing Mod at: ", modifier_stack_ref.rfind(landing_mod)) .enter() - if previous_speed_multiplier > 1.0: - speed_multiplier = previous_speed_multiplier - else: - speed_multiplier = 1.0 # Apply initial jump velocity on state enter move_component.velocity.y = -jump_force diff --git a/src/state_animated_actor.gd b/src/state_animated_actor.gd index dd5718c..371e21f 100644 --- a/src/state_animated_actor.gd +++ b/src/state_animated_actor.gd @@ -334,7 +334,7 @@ func move_actor_as_desired(delta: float, x_move_direction_override: float = 0): # The acceleration is differant # Perhaps it would be better to trigger this on a difference in modifier but they usually go together. if abs(move_component.acceleration.x) != abs(_move_modifier_move_acceleration + _move_acceleration): - if move_component.desired_movement_vector.x != 0: + if move_direction: print("Acceleration changed.", abs(move_component.acceleration.x), "-", (_move_modifier_move_acceleration + _move_acceleration)) move_component.acceleration.x = _move_modifier_move_acceleration + _move_acceleration @@ -360,21 +360,28 @@ func move_actor_as_desired(delta: float, x_move_direction_override: float = 0): sign(current_x_velocity) == 1) or (sign(move_component.desired_movement_vector.x) == -1 and sign(current_x_velocity) == -1): print("be more opposite") + if sign(_move_speed_modifier) == 1: + print("faster faster.") elif sign(move_component.desired_movement_vector.x) == sign(current_x_velocity) and move_component.momentum.x != 0: - if sign(move_component.acceleration.x) != sign(move_component.momentum.x): + if sign(move_component.acceleration.x) != sign(move_component.momentum.x) and x_move_direction_override == 0: print("Step it up!") # Flip the direction of the acceleration move_component.acceleration.x *= -1 if move_component.momentum.x <= 0 and _move_speed_modifier !=0: #if we're trying to move but we have no momentum applied currently - if move_component.desired_movement_vector.x != 0: + #if move_component.desired_movement_vector.x != 0: + if move_direction: move_component.acceleration.x = _move_modifier_move_acceleration + _move_acceleration ##TODO: I don't know where I should actually set the momentum. : if sign(_move_speed_modifier) == -1: # decreased speed modifier move_component.momentum.x = 0 elif sign(_move_speed_modifier) == +1: # increased speed modifier move_component.momentum.x = abs(move_speed_modifier) - + if move_component.momentum.x > 0 and _move_speed_modifier == 0: + if sign(move_component.acceleration.x) == sign(move_component.momentum.x): + print("Whoh Woah your done.") + # Flip the direction of the acceleration + move_component.acceleration.x *= -1 ##TODO: I don't know where I should actually set the momentum. : # This was not the place # if sign(_move_speed_modifier) == -1: # decreased speed modifier @@ -420,9 +427,11 @@ func move_actor_as_desired(delta: float, x_move_direction_override: float = 0): move_component.momentum.x = clamp(move_component.momentum.x, 0, _move_speed_modifier ) new_move_speed = _move_speed + move_component.momentum.x # + jerk else: # physics won't apply here - move_component.acceleration.x = 0 - move_component.momentum.x = 0 - new_move_speed = _move_speed +# move_component.acceleration.x = 0 +# move_component.momentum.x = 0 +# new_move_speed = _move_speed + move_component.momentum.x = clamp(move_component.momentum.x, 0, MIN_SPEED ) + new_move_speed = _move_speed + move_component.momentum.x # + jerk #new_move_speed = clamp(new_move_speed, MIN_SPEED, MAX_SPEED) @@ -434,7 +443,7 @@ func move_actor_as_desired(delta: float, x_move_direction_override: float = 0): ")\nNS:" + str(round(sim_move_speed)) + #" Z:" + str(sign(_move_speed_modifier) * -1 * move_component.momentum.x) + "\nS:" + str(round(_move_speed + _move_speed_modifier)) + ",M" + str(round(move_component.momentum.x)) + ",A" + str(round(move_component.acceleration.x)) + - "\nVel:" + str(round(move_component.sim_velocity.x)) + "Min:" + str(round(MIN_SPEED)) + ",Max:" + str(round(MAX_SPEED)) + "\nVel:" + str(round(move_component.velocity.x)) + "Min:" + str(round(MIN_SPEED)) + ",Max:" + str(round(MAX_SPEED)) ) # str(round(jerk)) move_component.sim_velocity.x = move_direction * sim_move_speed