Add movement_switched signal to player for movement type changes; adjust variable alignment in get_next_movement_type
This commit is contained in:
@@ -5,6 +5,7 @@ extends CharacterBody2D
|
|||||||
@export var movement_types: Dictionary = {}
|
@export var movement_types: Dictionary = {}
|
||||||
|
|
||||||
var current_movement: PlayerMovement = null
|
var current_movement: PlayerMovement = null
|
||||||
|
signal movement_switched(movement_type: String)
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -33,6 +34,7 @@ func switch_movement(movement_type: String) -> void:
|
|||||||
push_error("Movement type '%s' not found in movement_types." % movement_type)
|
push_error("Movement type '%s' not found in movement_types." % movement_type)
|
||||||
return
|
return
|
||||||
current_movement.enabled = true
|
current_movement.enabled = true
|
||||||
|
movement_switched.emit(current_movement.type)
|
||||||
else:
|
else:
|
||||||
push_error("Movement type '%s' not found in movement_types." % movement_type)
|
push_error("Movement type '%s' not found in movement_types." % movement_type)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user