diff --git a/lib/classes/movement_state_receiver.gd b/lib/classes/movement_state_receiver.gd index cf281da..dc7e2ae 100644 --- a/lib/classes/movement_state_receiver.gd +++ b/lib/classes/movement_state_receiver.gd @@ -158,8 +158,10 @@ func new_move_actor_as_desired(_delta :float, } var calc_velocity = Vector2.ZERO var calc_acceleration = Vector2.ZERO - #var calc_inertia = Vector2.ZERO - var calc_inertia = velocity.abs() + var calc_inertia :Vector2 + calc_inertia.x = abs(velocity.x) + ##TODO: Only implemented horizontal so far. + calc_inertia.y = velocity.y var calc_inertial_dir = Vector2(sign(velocity.x),sign(velocity.y)) var calc_friction :Vector2 = Vector2.ZERO @@ -247,7 +249,6 @@ func new_move_actor_as_desired(_delta :float, ## For now, y component of velocity is just gravity #calc_velocity.y = movement_params["_gravity"] * Vector2.DOWN.y - calc_inertia.y = velocity.y calc_inertia.y += movement_params["_gravity"] * _delta calc_velocity.y = calc_inertia.y @@ -255,6 +256,7 @@ func new_move_actor_as_desired(_delta :float, ## Can't do it this way when we have initia #calc_velocity.x = calc_inertia.x * move_direction.x + ## Control, direction can only be controlled when overcome inertia direction. if calc_inertial_dir.x != 0: calc_velocity.x = calc_inertia.x * calc_inertial_dir.x else: diff --git a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd index 8a93874..5845538 100644 --- a/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd +++ b/src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd @@ -319,9 +319,14 @@ func _state_process_physics_move(): if !parent.is_on_floor(): request_state_change.call_func('fall') + ## First version #move_actor_as_desired() - var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state ) - apply_movement_to_parent(_v) + + ## Second One + #var _v :Vector2 = new_move_actor_as_desired( physics_delta , current_state ) + #apply_movement_to_parent(_v) + + apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state )) func get_climb_shape_location() -> Vector2: if $"%LadderDetector".is_colliding(): diff --git a/src/actors/players/playerE/states/idle.tres b/src/actors/players/playerE/states/idle.tres index 52d8b7f..e9e77fe 100644 --- a/src/actors/players/playerE/states/idle.tres +++ b/src/actors/players/playerE/states/idle.tres @@ -10,7 +10,7 @@ debug_state = false timeout_seconds = 0.0 name = "idle" horizontal_speed = 1.36422e-12 -horizontal_acceleration = 2.0 +horizontal_acceleration = 0.0 horizontal_speed_offset = 0.0 horizontal_speed_offset_acceleration = 0.0 jerk_factor = 0.0