Switch player input processing routines from event based to polling based in process_physics
This commit is contained in:
parent
ae9256f083
commit
27de78f02a
|
|
@ -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)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -52,11 +52,18 @@ func process_physics(delta):
|
|||
move_actor_as_desired(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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user