diff --git a/src/classes/velocity_controller.gd b/src/classes/velocity_controller.gd index 48e0182..7366334 100644 --- a/src/classes/velocity_controller.gd +++ b/src/classes/velocity_controller.gd @@ -41,9 +41,6 @@ func calculate_velocity(_delta :float, ## We're now toing to preserve inertia direction calc_inertia.x = calc_velocity.x calc_inertia.y = calc_velocity.y - - var calc_inertial_dir = Vector2(sign(calc_velocity.x),sign(calc_velocity.y)) - #var calc_friction :Vector2 = Vector2.ZERO ## Determine movement direction # If there is an inertia direction from existing velocity and @@ -262,7 +259,7 @@ func resolve_inertia(range_placement :int, inertia :float , speed_range :Vector2, delta_acceleration :float) -> float: - if speed_range.x != speed_range.y and delta_acceleration != 0.0: + if speed_range.x != speed_range.y and is_zero_approx(delta_acceleration) == false: var direction_accel :float = delta_acceleration #* move_direction.x if speed_range.x > speed_range.y: direction_accel *= -1 @@ -294,7 +291,7 @@ func resolve_inertia(range_placement :int, max(inertia, speed_range.y)) - elif inertia != 0.0 and delta_acceleration != 0.0: ## We still have inertia but no difference in movement + elif inertia != 0.0 and is_zero_approx(delta_acceleration) == false: ## We still have inertia but no difference in movement var clamped_speed = speed_range.x if speed_range.x < speed_range.y: clamped_speed = clamp(speed_range.x,0.0,speed_range.y) @@ -305,7 +302,8 @@ func resolve_inertia(range_placement :int, else: ## inertia is just base speed inertia = speed_range.x - #calc_inertial_dir.x = 0.0 # sign(calc_inertia.x) + if debug and speed_range.x == -90: + var foo = 2+2 return inertia diff --git a/src/levels/CloneBox.tscn b/src/levels/CloneBox.tscn index 27ff7da..0c7cbb8 100644 --- a/src/levels/CloneBox.tscn +++ b/src/levels/CloneBox.tscn @@ -43,7 +43,7 @@ __meta__ = { [node name="LevelTransition2" parent="." index="6" instance=ExtResource( 4 )] position = Vector2( 332, 31 ) -_destination_level = "res://src/levels/TestBox.tscn" +_destination_level = "res://src/levels/TC_01.tscn" _destination_position_name = "EnterRight" [node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]