65 lines
1.7 KiB
GDScript
65 lines
1.7 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
|
|
|
|
# export (NodePath) var jump_node
|
|
|
|
# onready var jump_state: State = get_node(jump_node)
|
|
|
|
## Deprecated
|
|
# export var animation_name: String
|
|
|
|
# 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 adjusted_move_speed: float
|
|
var jerk: float
|
|
|
|
var physics_modifier :StateModifier
|
|
|
|
# Not sure if this should be here. probably not
|
|
export(Array, String) var animation_sequence
|
|
|
|
# can't remember what this did
|
|
export(Dictionary) var emitter_frame_subscriptions
|
|
var frame_signal_emitted: bool = false
|
|
|
|
|
|
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
|
|
|
var modifier: StateModifier
|
|
|
|
|
|
func enter() -> void:
|
|
# Call parent class enter
|
|
.enter()
|
|
|
|
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...")
|
|
|