From 173b8cc67c095c387bd18fff996d43c8a17e8702 Mon Sep 17 00:00:00 2001 From: Nitsud Yarg Date: Mon, 27 May 2024 19:37:35 -0700 Subject: [PATCH] Deprecated Animation name in states. Moved exports to State base class. --- project.godot | 2 +- src/playerC/Player.tscn | 7 +------ src/state.gd | 6 +++--- src/state_animated_actor.gd | 8 ++++---- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/project.godot b/project.godot index 2ad7811..5c55206 100644 --- a/project.godot +++ b/project.godot @@ -9,7 +9,7 @@ config_version=4 _global_script_classes=[ { -"base": "Node", +"base": "Reference", "class": "Movement", "language": "GDScript", "path": "res://src/playerC/player_move_component.gd" diff --git a/src/playerC/Player.tscn b/src/playerC/Player.tscn index addaa08..603317c 100644 --- a/src/playerC/Player.tscn +++ b/src/playerC/Player.tscn @@ -443,7 +443,6 @@ starting_state = NodePath("idle") [node name="idle" type="Node" parent="Controllers/state_machine"] script = ExtResource( 2 ) -animation_name = "idle" move_speed = 90.0 animation_sequence = [ "idle" ] jump_node = NodePath("../jump") @@ -453,7 +452,6 @@ fire_node = NodePath("../fire") [node name="jump" type="Node" parent="Controllers/state_machine"] script = ExtResource( 7 ) -animation_name = "jump" move_speed = 90.0 animation_sequence = [ "jump" ] idle_node = NodePath("../idle") @@ -472,7 +470,6 @@ dash_node = NodePath(".") [node name="fall" type="Node" parent="Controllers/state_machine"] script = ExtResource( 4 ) -animation_name = "jump" move_speed = 90.0 animation_sequence = [ "jump" ] idle_node = NodePath("../idle") @@ -480,15 +477,13 @@ move_node = NodePath("../move") [node name="hurt" type="Node" parent="Controllers/state_machine"] script = ExtResource( 8 ) -animation_name = "hit" -move_speed = -25.0 timeout_seconds = 1.0 +move_speed = -25.0 animation_sequence = [ "hit" ] idle_node = NodePath("../idle") [node name="fire" type="Node" parent="Controllers/state_machine"] script = ExtResource( 10 ) -animation_name = "fire" timeout_seconds = 1.0 animation_sequence = [ "fire" ] jump_node = NodePath("../jump") diff --git a/src/state.gd b/src/state.gd index 81d707e..46f2039 100644 --- a/src/state.gd +++ b/src/state.gd @@ -1,11 +1,11 @@ class_name State extends Node +export var timeout_seconds: float = 0.0 # Declare member variables here. Examples: -# var a = 2 -# var b = "text" - +var modifier_stack_ref: Array # Well this didn't work +var state_timeout: Timer # Called when the node enters the scene tree for the first time. func _ready(): diff --git a/src/state_animated_actor.gd b/src/state_animated_actor.gd index 9a9e09e..ddf3ead 100644 --- a/src/state_animated_actor.gd +++ b/src/state_animated_actor.gd @@ -13,9 +13,10 @@ extends State # onready var jump_state: State = get_node(jump_node) -export var animation_name: String +## Deprecated +# export var animation_name: String + export var move_speed: float = 60 -export var timeout_seconds: float = 0.0 export(Array, String) var animation_sequence # this just wouldn't work well. Maybe I can try a resource @@ -27,7 +28,6 @@ var animation_index: int = 0 var current_animation_sequence: int = 0 var animation_suffix: String = ''; -var modifier_stack_ref: Array # Well this didn't work var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity") @@ -37,7 +37,7 @@ var parent: KinematicBody2D #var animation_sequence_timer: Timer -var state_timeout: Timer + func _ready(): # Only add timout node if timer value was specified.