This commit is contained in:
Dustin 2025-04-13 13:14:24 -07:00
parent 19c15fab5d
commit caac6e3ccd
3 changed files with 26 additions and 19 deletions

View File

@ -37,10 +37,12 @@ func _ready():
default_transform = transform default_transform = transform
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): func _physics_process(delta):
# pass #UiManager.debug_text = current_state.name
## Stard state process routines
if has_method('_state_physics_process_' + current_state.name):
call('_state_physics_process_' + current_state.name)
## Standard function for receiving state change ## Standard function for receiving state change
func _on_state_change(old_state_name:String, new_state :State): func _on_state_change(old_state_name:String, new_state :State):

View File

@ -11,19 +11,22 @@ func _ready():
pass # Replace with function body. pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. func _state_physics_process_attack_sword():
#func _process(delta): match current_state.animation_frame:
# pass 0:
set_deferred("disabled", true)
1:
set_deferred("disabled", false)
2:
transform.origin = Vector2(0,-17)
3:
transform.origin = Vector2(20,0)
5:
transform.origin = Vector2(20,10)
_:
set_deferred("disabled", true)
func _on_state_change_attack_sword(): func _on_state_change_attack_sword():
print ("<---- Hey you called me to Hurt Someone!") print ("<---- Hey you called me to Hurt Someone!")
transform = transform.translated(Vector2(-10,10))
match current_state.animation_frame:
2:
transform.origin = Vector2(0,-16)
3:
transform.origin = Vector2(19,0)
5:
transform.origin = Vector2(20,0)
_:
set_deferred("disabled", true)

View File

@ -79,7 +79,7 @@ extents = Vector2( 7, 14 )
extents = Vector2( 9, 15 ) extents = Vector2( 9, 15 )
[sub_resource type="RectangleShape2D" id=7] [sub_resource type="RectangleShape2D" id=7]
extents = Vector2( 10, 3 ) extents = Vector2( 4, 3 )
[node name="PlayerE" instance=ExtResource( 1 )] [node name="PlayerE" instance=ExtResource( 1 )]
script = ExtResource( 3 ) script = ExtResource( 3 )
@ -168,15 +168,17 @@ interactable_parent_callback = "touch_the_thing"
[node name="PewMachine" parent="." index="12" instance=ExtResource( 28 )] [node name="PewMachine" parent="." index="12" instance=ExtResource( 28 )]
[node name="Hitbox_Component" parent="." index="13" instance=ExtResource( 33 )] [node name="Hitbox_Component" parent="." index="13" instance=ExtResource( 33 )]
collision_layer = 64 collision_layer = 192
damage_amount = 10 damage_amount = 10
[node name="CollisionShape2D_StateReceiver" type="CollisionShape2D" parent="Hitbox_Component" index="0"] [node name="CollisionShape2D_StateReceiver" type="CollisionShape2D" parent="Hitbox_Component" index="0"]
modulate = Color( 1, 0, 0, 1 ) modulate = Color( 1, 0, 0, 1 )
position = Vector2( -20, 0 ) position = Vector2( -15, 14 )
shape = SubResource( 7 ) shape = SubResource( 7 )
disabled = true
script = ExtResource( 32 ) script = ExtResource( 32 )
callable_state_machine = NodePath("../../Movement_StateMachine") callable_state_machine = NodePath("../../Movement_StateMachine")
disable_shape_when_no_state_function = true
[connection signal="state_changed" from="Movement_StateMachine" to="." method="_on_Movement_StateMachine_state_changed"] [connection signal="state_changed" from="Movement_StateMachine" to="." method="_on_Movement_StateMachine_state_changed"]
[connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"] [connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"]