57 lines
1.7 KiB
GDScript
57 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
|
|
|
|
# Movement Speed in Pixels Per Second
|
|
# The b
|
|
export var horizontal_speed: float = 60
|
|
export var horizontal_acceleration: float = 0
|
|
## Movement Speed Offsets (Positive or Negative)
|
|
export var horizontal_speed_offset: float = 0
|
|
## Applies only if offset applies
|
|
export var horizontal_speed_offset_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
|
|
|
|
## Variables intended to allow state receivers to communicate
|
|
var animation_finished: bool = false
|
|
var movement_stopped: bool = false
|
|
|
|
# Not sure if this should be here. probably not
|
|
export(Array, String) var animation_sequence
|
|
|
|
func enter() -> void:
|
|
|
|
# Call parent class enter
|
|
.enter()
|
|
animation_finished = false
|
|
movement_stopped = 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...")
|
|
|