Bug fix and linking to another level

This commit is contained in:
Dustin 2025-05-26 20:49:33 -07:00
parent 4a95ec08f4
commit 3b37b568c5
2 changed files with 5 additions and 7 deletions

View File

@ -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

View File

@ -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"]