Switch player input processing routines from event based to polling based in process_physics

This commit is contained in:
Dustin 2025-03-17 20:19:44 -07:00
parent ae9256f083
commit 27de78f02a
2 changed files with 16 additions and 5 deletions

View File

@ -49,6 +49,10 @@ func _unhandled_input(event: InputEvent) -> void:
#movement_state_machine.process_input(event)
func _physics_process(delta: float) -> void:
# Input based or polling input is not done in _unhandled_input
# gives us the ability to turn off polling this way
if actor_type == "Player":
movement_component.process_physics_input(delta)
movement_component.process_physics(delta)
#movement_state_machine.process_physics(delta)
#

View File

@ -53,10 +53,17 @@ func process_physics(delta):
if has_method('_state_process_physics_' + current_state.name):
call('_state_process_physics_' + current_state.name)
# Shouldn't need a proces function
#func process(delta):
# pass
# more likely needed for Players
func process_physics_input(delta):
if has_method('_state_process_physics_input_' + current_state.name):
call('_state_process_physics_input_' + current_state.name)
# More likely needed for NPCs
func process(delta):
if has_method('_state_process_' + current_state.name):
call('_state_process_' + current_state.name)
# For event based input polling (Hadouken?)
func process_input(event: InputEvent):
if has_method('_state_process_input_' + current_state.name):
call('_state_process_input_' + current_state.name)