Compare commits
No commits in common. "d9b5d2785545a54d64da7dfafa8faec2383b07ce" and "ab0d2ac5b78839c8b2e0fe3bb96f23bef5f4a818" have entirely different histories.
d9b5d27855
...
ab0d2ac5b7
|
|
@ -1,133 +0,0 @@
|
|||
class_name DumbOldStateModifier
|
||||
extends Reference
|
||||
## State modification
|
||||
##
|
||||
## A state modifier doesn't have any direct control of a game object.
|
||||
## They are transfered from the enter and exit of other states and
|
||||
## influence the movement or animation of their parent states.
|
||||
## Rather than going full into paralell state machines I hope that this
|
||||
## modifier will be suitable for a basic state machine.
|
||||
##
|
||||
## @WIP
|
||||
|
||||
enum TYPE {NONE,EXIT_ANIMATION, ANIMATION_SUFFIX, REPLACE_ANIMATION}
|
||||
|
||||
var debug_state: bool = false
|
||||
|
||||
## These should be the original properties set when the modifier is created.
|
||||
# property changes can be applied over time but these are the instantiated values.
|
||||
var modifier_properties: ModifierProperties
|
||||
|
||||
## Animation modifier variables
|
||||
## The name of the animation that could be applied and starting frame
|
||||
var animation_name: String
|
||||
var starting_frame: int = 0
|
||||
##TODO: Animation speed
|
||||
|
||||
## Modification Type
|
||||
## if an animation is specified, the default behavior will be just to override
|
||||
## the state animation. Or perform a 'Replace Animation'
|
||||
var modifier_type = TYPE.NONE
|
||||
|
||||
var name :String = ''
|
||||
|
||||
# Move Speed in Pixels Per Second
|
||||
# These should only apply if Modification Type Set to None.
|
||||
# (But I'm not sure if I like that model.)
|
||||
#var move_speed: float
|
||||
#var move_speed_modifier: float = 0
|
||||
#var move_speed_modifier_decay: float = 0
|
||||
|
||||
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
|
||||
# Attempting to use this as an animation suffix that can linger after
|
||||
# state transition like 'run-fire' to 'idle-fire' 'jump-fire' etc.
|
||||
#var animation_suffix: bool = false
|
||||
#var pre_append_animation: bool = false
|
||||
|
||||
# not sure if I can do the array thing from state change. Maybe?
|
||||
# disabling this sequencing for now.
|
||||
# export(Array, String) var animation_sequence
|
||||
# var animation_index: int = 0
|
||||
# var current_animation_sequence: int = 0
|
||||
|
||||
|
||||
#var animation_sequence_timer: Timer
|
||||
|
||||
var state_timeout: Timer
|
||||
var timeout_seconds: float = 0.0
|
||||
|
||||
# Meant to be called on timeout or other counters this modifier may have.
|
||||
# Should be updated whenever modifier owner transfers
|
||||
var state_call_function: FuncRef
|
||||
|
||||
## Can't do it this way.
|
||||
#func copy_modifier() -> StateModifier:
|
||||
# var new_modifier = StateModifier.new()
|
||||
# new_modifier.ready(animation_name, modifier_type, timeout_seconds)
|
||||
#
|
||||
# return StateModifier.new()
|
||||
#
|
||||
func merge_modifier(merging_mod: ModifierProperties):
|
||||
if merging_mod.modifier_type != TYPE.NONE:
|
||||
print("Warning Merging modifier types that aren't set to 'none' is not supported!")
|
||||
return
|
||||
# Can't support timeouts or animation stuff right now.
|
||||
#timeout_seconds = merging_mod.timeout_seconds
|
||||
# move_speed = merging_mod.move_speed
|
||||
# gravity = merging_mod.gravity
|
||||
# move_speed_modifier = merging_mod.move_speed_modifier
|
||||
# move_speed_modifier_decay = merging_mod.move_speed_modifier_decay
|
||||
|
||||
|
||||
func get_modifier_properties() -> ModifierProperties:
|
||||
#( p_move_speed:float, p_gravity:int , p_move_acceleration , p_move_speed_modifier:float,
|
||||
# p_move_modifier_move_acceleration:float, p_jerk_factor: float):
|
||||
var mp = ModifierProperties.new( modifier_properties.move_speed,
|
||||
modifier_properties.gravity,
|
||||
modifier_properties.move_acceleration,
|
||||
modifier_properties.move_speed_modifier,
|
||||
modifier_properties.move_modifier_move_acceleration,
|
||||
modifier_properties.jerk_factor)
|
||||
mp.directional_modifier = modifier_properties.directional_modifier
|
||||
return mp
|
||||
|
||||
func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
|
||||
name = modifier_name
|
||||
# If somebody forgot to specify the type
|
||||
if anim_name != '' and type == TYPE.NONE:
|
||||
modifier_type = TYPE.REPLACE_ANIMATION
|
||||
animation_name = anim_name
|
||||
modifier_type = type
|
||||
# if parent != null and function_name != "":
|
||||
# state_call_function = funcref(parent, function_name)
|
||||
|
||||
modifier_properties = ModifierProperties.new(0,0,0,0,0,0)
|
||||
|
||||
if timeout > 0:
|
||||
state_timeout = Timer.new()
|
||||
state_timeout.wait_time = timeout
|
||||
state_timeout.one_shot = true
|
||||
state_timeout.autostart = false
|
||||
return state_timeout
|
||||
#add_child(state_timeout)
|
||||
#ModifierProperties.new()
|
||||
return null
|
||||
|
||||
|
||||
## Transfer and callback related methods. These sort of worked but I didn't end up using them
|
||||
## They're an interesting idea though.
|
||||
func transfer_owner(parent:Node):
|
||||
print("Modifier owner will now be: ", parent.name)
|
||||
state_call_function = funcref(parent, 'update_animation')
|
||||
|
||||
func _on_Timer_timeout():
|
||||
#print("Oh Crap! I can't beleive it worked")
|
||||
if state_call_function:
|
||||
if state_call_function.is_valid():
|
||||
state_call_function.call_func()
|
||||
else:
|
||||
print("Warning! Modifier timed out with no callback to alert.")
|
||||
else:
|
||||
print("Warning! no function applies.")
|
||||
|
|
@ -11,7 +11,6 @@ onready var current_state = StateAnimatedActor.new()
|
|||
|
||||
#var animation_finished: bool = false
|
||||
var request_state_change: FuncRef
|
||||
var add_state_modifier: FuncRef
|
||||
|
||||
# this just wouldn't work well. Maybe I can try a resource
|
||||
# export(Array, NodePath) var transition_state_nodes
|
||||
|
|
@ -33,8 +32,6 @@ var previous_speed_multiplier: float
|
|||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
|
||||
add_state_modifier = funcref(get_node(callable_state_machine),'push_state_modifier')
|
||||
|
||||
get_node(callable_state_machine).connect("state_changed", self,"_on_state_change")
|
||||
self.connect("animation_finished",self,"_on_animation_finished")
|
||||
|
||||
|
|
@ -88,9 +85,6 @@ func change_animation(enter_frame := 0, index := 0, suffix := ''):
|
|||
# if modifier.state_timeout and modifier.timeout_seconds == 0:
|
||||
# modifier = null
|
||||
|
||||
if current_state.modifier:
|
||||
print("hey you got one! -> ", current_state.modifier.name)
|
||||
|
||||
# By Default, we build an animation sequence off of this state's before checking
|
||||
# for modifiers
|
||||
var animation_sequence = current_state.animation_sequence
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ func _on_state_change(old_state_name:String, new_state :State):
|
|||
|
||||
func move_actor_as_desired( x_move_direction_override: float = 0):
|
||||
var delta:float = physics_delta
|
||||
var _move_speed = current_state.horizontal_speed
|
||||
var _move_acceleration = current_state.horizontal_acceleration
|
||||
var _move_speed_modifier = current_state.horizontal_speed_offset
|
||||
var _move_modifier_move_acceleration = current_state.horizontal_speed_offset_acceleration
|
||||
var _move_speed = current_state.move_speed
|
||||
var _move_speed_modifier = current_state.move_speed_modifier
|
||||
var _move_modifier_move_acceleration = current_state.move_modifier_move_acceleration
|
||||
var _move_acceleration = current_state.move_acceleration
|
||||
var _jerk_factor = current_state.jerk_factor
|
||||
var _gravity = current_state.gravity
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ signal state_exited()
|
|||
var state_timeout: Timer
|
||||
var state_ready: bool = true
|
||||
|
||||
var modifier: StateModifier
|
||||
|
||||
export var name: String
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
|
@ -57,7 +55,6 @@ func enter() -> void:
|
|||
|
||||
func exit() -> void:
|
||||
emit_signal("state_exited")
|
||||
modifier = null
|
||||
return
|
||||
|
||||
# Disable to test whether actually needed.
|
||||
|
|
|
|||
|
|
@ -10,13 +10,10 @@ extends State
|
|||
## @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 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")
|
||||
|
|
@ -30,6 +27,11 @@ 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
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ signal state_changed(old_state_name, new_state)
|
|||
|
||||
|
||||
var current_state: State
|
||||
var state_modifiers: Array
|
||||
|
||||
#var state_modifiers: Array
|
||||
export var starting_state_name = 'default'
|
||||
export(Array,Resource) var states
|
||||
var states_index :Dictionary
|
||||
|
|
@ -62,15 +61,11 @@ func change_state(new_state: State) -> void:
|
|||
|
||||
current_state = new_state
|
||||
current_state.enter()
|
||||
|
||||
if(state_modifiers.size() > 0):
|
||||
print("Active Modifiers:")
|
||||
for mods in state_modifiers:
|
||||
if mods is AnimationStateModifier:
|
||||
print(mods.name, "asm")
|
||||
current_state.modifier = mods #mods.copy_AnimationStateModifier(AnimationStateModifier.new())
|
||||
|
||||
emit_signal("state_changed",current_state_name,current_state)
|
||||
# if(state_modifiers.size() > 0 and debug_state_machine):
|
||||
# print("Active Modifiers:")
|
||||
# for mods in state_modifiers:
|
||||
# print(mods.name)
|
||||
|
||||
func change_to_known_state(new_state_name: String) -> void:
|
||||
if new_state_name.empty() == false:
|
||||
|
|
@ -86,11 +81,6 @@ func get_state_reference(state_name: String) -> State:
|
|||
return states_index[state_name]
|
||||
return null
|
||||
|
||||
func push_state_modifier(_state_modifier: StateModifier) -> void:
|
||||
if state_modifiers.has(_state_modifier) == false:
|
||||
state_modifiers.push_front(_state_modifier)
|
||||
print("Add State Modifier: ", _state_modifier.name, " now size ", state_modifiers.size())
|
||||
|
||||
# Disable to test whether actually needed.
|
||||
## Pass through functions for the Player to call,
|
||||
## handling state changes as needed.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class_name StateModifier
|
||||
class_name DumbOldStateModifier
|
||||
extends Reference
|
||||
## State modification
|
||||
##
|
||||
|
|
@ -12,8 +12,16 @@ extends Reference
|
|||
|
||||
enum TYPE {NONE,EXIT_ANIMATION, ANIMATION_SUFFIX, REPLACE_ANIMATION}
|
||||
|
||||
var debug: bool = false
|
||||
var debug_state: bool = false
|
||||
|
||||
## These should be the original properties set when the modifier is created.
|
||||
# property changes can be applied over time but these are the instantiated values.
|
||||
var modifier_properties: ModifierProperties
|
||||
|
||||
## Animation modifier variables
|
||||
## The name of the animation that could be applied and starting frame
|
||||
var animation_name: String
|
||||
var starting_frame: int = 0
|
||||
##TODO: Animation speed
|
||||
|
||||
## Modification Type
|
||||
|
|
@ -22,7 +30,6 @@ var debug: bool = false
|
|||
var modifier_type = TYPE.NONE
|
||||
|
||||
var name :String = ''
|
||||
var ready :bool = false
|
||||
|
||||
# Move Speed in Pixels Per Second
|
||||
# These should only apply if Modification Type Set to None.
|
||||
|
|
@ -31,7 +38,7 @@ var ready :bool = false
|
|||
#var move_speed_modifier: float = 0
|
||||
#var move_speed_modifier_decay: float = 0
|
||||
|
||||
#var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
|
||||
# Attempting to use this as an animation suffix that can linger after
|
||||
|
|
@ -48,76 +55,72 @@ var ready :bool = false
|
|||
|
||||
#var animation_sequence_timer: Timer
|
||||
|
||||
var timeout: Timer
|
||||
var state_timeout: Timer
|
||||
var timeout_seconds: float = 0.0
|
||||
|
||||
# Meant to be called on timeout or other counters this modifier may have.
|
||||
# Should be updated whenever modifier owner transfers
|
||||
var state_call_function: FuncRef
|
||||
|
||||
#func merge_modifier(merging_mod: ModifierProperties):
|
||||
# if merging_mod.modifier_type != TYPE.NONE:
|
||||
# print("Warning Merging modifier types that aren't set to 'none' is not supported!")
|
||||
# return
|
||||
## Can't do it this way.
|
||||
#func copy_modifier() -> StateModifier:
|
||||
# var new_modifier = StateModifier.new()
|
||||
# new_modifier.ready(animation_name, modifier_type, timeout_seconds)
|
||||
#
|
||||
# return StateModifier.new()
|
||||
#
|
||||
func merge_modifier(merging_mod: ModifierProperties):
|
||||
if merging_mod.modifier_type != TYPE.NONE:
|
||||
print("Warning Merging modifier types that aren't set to 'none' is not supported!")
|
||||
return
|
||||
# Can't support timeouts or animation stuff right now.
|
||||
#timeout_seconds = merging_mod.timeout_seconds
|
||||
# move_speed = merging_mod.move_speed
|
||||
# gravity = merging_mod.gravity
|
||||
# move_speed_modifier = merging_mod.move_speed_modifier
|
||||
# move_speed_modifier_decay = merging_mod.move_speed_modifier_decay
|
||||
|
||||
#func get_modifier_properties() -> ModifierProperties:
|
||||
# #( p_move_speed:float, p_gravity:int , p_move_acceleration , p_move_speed_modifier:float,
|
||||
# # p_move_modifier_move_acceleration:float, p_jerk_factor: float):
|
||||
# var mp = ModifierProperties.new( modifier_properties.move_speed,
|
||||
# modifier_properties.gravity,
|
||||
# modifier_properties.move_acceleration,
|
||||
# modifier_properties.move_speed_modifier,
|
||||
# modifier_properties.move_modifier_move_acceleration,
|
||||
# modifier_properties.jerk_factor)
|
||||
# mp.directional_modifier = modifier_properties.directional_modifier
|
||||
# return mp
|
||||
|
||||
func setup(modifier_name:String, type = TYPE.NONE,_timeout_seconds : float = 0):
|
||||
func get_modifier_properties() -> ModifierProperties:
|
||||
#( p_move_speed:float, p_gravity:int , p_move_acceleration , p_move_speed_modifier:float,
|
||||
# p_move_modifier_move_acceleration:float, p_jerk_factor: float):
|
||||
var mp = ModifierProperties.new( modifier_properties.move_speed,
|
||||
modifier_properties.gravity,
|
||||
modifier_properties.move_acceleration,
|
||||
modifier_properties.move_speed_modifier,
|
||||
modifier_properties.move_modifier_move_acceleration,
|
||||
modifier_properties.jerk_factor)
|
||||
mp.directional_modifier = modifier_properties.directional_modifier
|
||||
return mp
|
||||
|
||||
func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
|
||||
name = modifier_name
|
||||
# If somebody forgot to specify the type
|
||||
if anim_name != '' and type == TYPE.NONE:
|
||||
modifier_type = TYPE.REPLACE_ANIMATION
|
||||
animation_name = anim_name
|
||||
modifier_type = type
|
||||
# if parent != null and function_name != "":
|
||||
# state_call_function = funcref(parent, function_name)
|
||||
|
||||
if _timeout_seconds > 0:
|
||||
timeout = Timer.new()
|
||||
timeout.wait_time = _timeout_seconds
|
||||
timeout.one_shot = true
|
||||
timeout.autostart = false
|
||||
modifier_properties = ModifierProperties.new(0,0,0,0,0,0)
|
||||
|
||||
func copy(_copy_state: StateModifier):
|
||||
_copy_state.name = name
|
||||
_copy_state.modifier_type = modifier_type
|
||||
|
||||
func merge(_copy_state: StateModifier):
|
||||
pass
|
||||
|
||||
|
||||
#func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
|
||||
# name = modifier_name
|
||||
# # If somebody forgot to specify the type
|
||||
# if anim_name != '' and type == TYPE.NONE:
|
||||
# modifier_type = TYPE.REPLACE_ANIMATION
|
||||
# animation_name = anim_name
|
||||
# modifier_type = type
|
||||
## if parent != null and function_name != "":
|
||||
## state_call_function = funcref(parent, function_name)
|
||||
#
|
||||
## modifier_properties = ModifierProperties.new(0,0,0,0,0,0)
|
||||
#
|
||||
# if timeout > 0:
|
||||
# state_timeout = Timer.new()
|
||||
# state_timeout.wait_time = timeout
|
||||
# state_timeout.one_shot = true
|
||||
# state_timeout.autostart = false
|
||||
# return state_timeout
|
||||
# #add_child(state_timeout)
|
||||
# #ModifierProperties.new()
|
||||
# return null
|
||||
if timeout > 0:
|
||||
state_timeout = Timer.new()
|
||||
state_timeout.wait_time = timeout
|
||||
state_timeout.one_shot = true
|
||||
state_timeout.autostart = false
|
||||
return state_timeout
|
||||
#add_child(state_timeout)
|
||||
#ModifierProperties.new()
|
||||
return null
|
||||
|
||||
|
||||
## Transfer and callback related methods. These sort of worked but I didn't end up using them
|
||||
## They're an interesting idea though.
|
||||
#func transfer_owner(parent:Node):
|
||||
# print("Modifier owner will now be: ", parent.name)
|
||||
# state_call_function = funcref(parent, 'update_animation')
|
||||
func transfer_owner(parent:Node):
|
||||
print("Modifier owner will now be: ", parent.name)
|
||||
state_call_function = funcref(parent, 'update_animation')
|
||||
|
||||
func _on_Timer_timeout():
|
||||
#print("Oh Crap! I can't beleive it worked")
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
class_name AnimationStateModifier
|
||||
extends StateModifier
|
||||
|
||||
|
||||
## Animation modifier variables
|
||||
## The name of the animation that could be applied and starting frame
|
||||
var animation_name: String = ''
|
||||
var animation_starting_frame: int = 0
|
||||
var animation_speed: float
|
||||
|
||||
func copy_AnimationStateModifier(_copy_state: AnimationStateModifier):
|
||||
.copy(_copy_state)
|
||||
_copy_state.animation_name = animation_name
|
||||
_copy_state.animation_starting_frame = animation_starting_frame
|
||||
_copy_state.animation_speed = animation_speed
|
||||
|
||||
|
||||
# This is probably not necessary just access properties directly
|
||||
#func animation_mod_setup( anim_name:String = ''):
|
||||
# # If somebody forgot to specify the type
|
||||
# if anim_name != '' and modifier_type == TYPE.NONE:
|
||||
# modifier_type = TYPE.REPLACE_ANIMATION
|
||||
# animation_name = anim_name
|
||||
## if parent != null and function_name != "":
|
||||
## state_call_function = funcref(parent, function_name)
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
class_name MovementStateModifier
|
||||
extends StateModifier
|
||||
|
||||
|
||||
var horizontal_speed: float = 0
|
||||
var horizontal_acceleration: float = 0
|
||||
## Movement Speed Offsets (Positive or Negative)
|
||||
var horizontal_speed_offset: float = 0
|
||||
## Applies only if offset applies
|
||||
var horizontal_speed_offset_acceleration: float = 0
|
||||
var jerk_factor: float = 0
|
||||
|
||||
var gravity: int = 0
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
class_name DEPR_ModifierProperties
|
||||
class_name ModifierProperties
|
||||
extends Reference
|
||||
|
||||
var modifier_type: int = 0
|
||||
|
|
@ -19,20 +19,10 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://lib/classes/animated_sprite_state_receiver.gd"
|
||||
}, {
|
||||
"base": "StateModifier",
|
||||
"class": "AnimationStateModifier",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/state_modifier_animation.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "DEPR_ModifierProperties",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/DEPR_state_modifier_properties.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "DumbOldStateModifier",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/DEPR_state_modifier.gd"
|
||||
"path": "res://lib/classes/state_modifier.gd"
|
||||
}, {
|
||||
"base": "",
|
||||
"class": "GitAPI",
|
||||
|
|
@ -64,6 +54,11 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://src/classes/Level.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "ModifierProperties",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/state_modifier_properties.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "Modifier_Receiver",
|
||||
"language": "GDScript",
|
||||
|
|
@ -74,11 +69,6 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://src/classes/movement_component.gd"
|
||||
}, {
|
||||
"base": "StateModifier",
|
||||
"class": "MovementStateModifier",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/state_modifier_movement.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Movement_StateReceiver",
|
||||
"language": "GDScript",
|
||||
|
|
@ -103,17 +93,10 @@ _global_script_classes=[ {
|
|||
"class": "StateMachineAnimatedActor",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/state_machine_animated_actor.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "StateModifier",
|
||||
"language": "GDScript",
|
||||
"path": "res://lib/classes/state_modifier.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Actor": "",
|
||||
"AnimatedSprite_StateReceiver": "",
|
||||
"AnimationStateModifier": "",
|
||||
"DEPR_ModifierProperties": "",
|
||||
"DumbOldStateModifier": "",
|
||||
"GitAPI": "",
|
||||
"HealthComponent": "",
|
||||
|
|
@ -121,15 +104,14 @@ _global_script_class_icons={
|
|||
"Interactable": "",
|
||||
"Interactable_Receiver": "",
|
||||
"Level": "",
|
||||
"ModifierProperties": "",
|
||||
"Modifier_Receiver": "",
|
||||
"MovementComponent": "",
|
||||
"MovementStateModifier": "",
|
||||
"Movement_StateReceiver": "",
|
||||
"State": "",
|
||||
"StateAnimatedActor": "",
|
||||
"StateMachine": "",
|
||||
"StateMachineAnimatedActor": "",
|
||||
"StateModifier": ""
|
||||
"StateMachineAnimatedActor": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
extends AnimatedSprite_StateReceiver
|
||||
|
||||
var attack_sword: AnimationStateModifier
|
||||
|
||||
func _ready():
|
||||
# Lets see if this nutty thing works
|
||||
var state_ref :State
|
||||
|
|
@ -10,10 +8,7 @@ func _ready():
|
|||
state_ref = get_node(callable_state_machine).get_state_reference('attack_sword')
|
||||
state_ref.connect("state_exited", self, "_on_state_exited_attack_sword")
|
||||
|
||||
attack_sword = AnimationStateModifier.new()
|
||||
attack_sword.setup('sword_drawn',StateModifier.TYPE.ANIMATION_SUFFIX,5.0)
|
||||
add_child(attack_sword.timeout)
|
||||
add_state_modifier.call_func(attack_sword)
|
||||
pass
|
||||
|
||||
# I don't need this right now but I proved it can be done!
|
||||
#func _state_process_idle():
|
||||
|
|
@ -51,5 +46,3 @@ func _on_state_change_fall():
|
|||
|
||||
func _on_state_exited_attack_sword():
|
||||
print("you just swung your sword, you should get a modifier.")
|
||||
attack_sword.timeout.start()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ script = ExtResource( 7 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "move"
|
||||
horizontal_speed = 90.0
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 90.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "run" ]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "attack_shoot"
|
||||
horizontal_speed = 1.36422e-12
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 1.36422e-12
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "attack-shoot" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "attack_sword"
|
||||
horizontal_speed = 1.36422e-12
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 1.36422e-12
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "attack-sword" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "fall"
|
||||
horizontal_speed = 90.0
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 90.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "jump" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "idle"
|
||||
horizontal_speed = 1.36422e-12
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 1.36422e-12
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "idle" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "jump"
|
||||
horizontal_speed = 90.0
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 90.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "jump" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "land"
|
||||
horizontal_speed = 20.0
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 30.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "land" ]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ script = ExtResource( 1 )
|
|||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "roll"
|
||||
horizontal_speed = 60.0
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
move_speed = 150.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "roll" ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user