Add state duration tracker to movement state receiver to re-enable drop through collision mask. drop through floor now better.

This commit is contained in:
Dustin 2025-06-15 09:19:07 -07:00
parent d3775c364f
commit 5196b3eb6e
2 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ var velocity_controller :VelocityController = VelocityController.new()
#var sim_velocity = Vector2(0,0) #var sim_velocity = Vector2(0,0)
var physics_delta:float var physics_delta:float
var process_delta:float var process_delta:float
var state_duration:float = 0.0 ## Tracks how long we've been in state
var modifier: StateModifierMovement var modifier: StateModifierMovement
@ -133,6 +134,8 @@ func get_climb_shape_location() -> Vector2:
return Vector2(-1,-1) return Vector2(-1,-1)
func _on_state_change(old_state_name:String, new_state :State): func _on_state_change(old_state_name:String, new_state :State):
## Reset State Duration Counter
state_duration = 0.0
###### State machine ###### State machine
if new_state is StateAnimatedActor: #Testing this. Update: It works if new_state is StateAnimatedActor: #Testing this. Update: It works
## Confirmed that I do neet to update the current_state with the passed state. ## Confirmed that I do neet to update the current_state with the passed state.

View File

@ -338,6 +338,8 @@ func _state_process_physics_fall():
var bar = $"%WallDetector".is_colliding() var bar = $"%WallDetector".is_colliding()
#parent.get_node("CollisionShape2D").set_deferred("disabled", false) #parent.get_node("CollisionShape2D").set_deferred("disabled", false)
state_duration += physics_delta
if (state_duration > .25):
parent.set_collision_mask_bit(9,true) parent.set_collision_mask_bit(9,true)
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding(): if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():