Attempt2/lib/classes/state_animated_actor.gd
2025-03-18 19:26:54 -07:00

57 lines
1.6 KiB
GDScript

class_name StateAnimatedActor
extends State
## Animation and movement state class
##
## A state intended to control the movement and animation
## functions of a KinimaticBody2D node. Initialized with a
## player, movement node, and kinematicbody2d
## I think if we also had modifier states that transfered along with the enter and entrance of nodes, that would be helpful.
##
## @WIP
# Movement Speed in Pixels Per Second
export var move_speed: float = 60
export var move_acceleration: float = 0
export var move_speed_modifier: float = 0
export var move_modifier_move_acceleration: float = 0
export var jerk_factor: float = 0
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
#var adjusted_move_speed: float
var jerk: float
var animation_finished: bool = false
# Not sure if this should be here. probably not
export(Array, String) var animation_sequence
# Modifiers may not be needed anymore.
var modifier: StateModifier
var physics_modifier :StateModifier
func enter() -> void:
# Call parent class enter
.enter()
animation_finished = false
jerk = 0
return
func transfer_modifiers(exiting_state_modifier : StateModifier):
if modifier == null: # We have no existing modifier applied.
match exiting_state_modifier.modifier_type:
exiting_state_modifier.TYPE.ANIMATION_SUFFIX:
if debug_state:
print("Transferring Animation Suffix")
modifier = exiting_state_modifier
exiting_state_modifier.TYPE.EXIT_ANIMATION:
if debug_state:
print("Exit Animation: well this was useless.")
else:
print("Insert modifier merge function here...")