Punch and hurtbox state receiver. We about done.
This commit is contained in:
parent
52086df5cc
commit
c17289f385
|
|
@ -5,6 +5,8 @@ export var callable_state_machine :NodePath
|
|||
|
||||
onready var current_state = StateAnimatedActor.new()
|
||||
|
||||
export var visible_when_no_state_function :bool = true
|
||||
|
||||
var modifier: StateModifierAnimatedActor
|
||||
|
||||
var request_state_change: FuncRef
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ func _on_state_change(old_state_name:String, new_state :State):
|
|||
if default_shape_when_no_state_function:
|
||||
if debug_component:
|
||||
print ("Returning to default collision shape")
|
||||
shape = default_shape
|
||||
if shape is RectangleShape2D:
|
||||
shape.extents = default_shape.extents
|
||||
transform = default_transform
|
||||
if disable_shape_when_no_state_function:
|
||||
set_deferred("disabled", true)
|
||||
|
|
|
|||
|
|
@ -13,16 +13,22 @@ func _ready():
|
|||
|
||||
func _state_physics_process_attack_sword():
|
||||
match current_state.animation_frame:
|
||||
0:
|
||||
set_deferred("disabled", true)
|
||||
1:
|
||||
set_deferred("disabled", false)
|
||||
2:
|
||||
transform.origin = Vector2(0,-17)
|
||||
3:
|
||||
set_deferred("disabled", false)
|
||||
3,4:
|
||||
transform.origin = Vector2(20,0)
|
||||
5:
|
||||
transform.origin = Vector2(20,10)
|
||||
|
||||
var org_extents: Vector2
|
||||
func _state_physics_process_attack_punch():
|
||||
match current_state.animation_frame:
|
||||
4,5:
|
||||
transform.origin = Vector2(22,-1)
|
||||
if shape is RectangleShape2D:
|
||||
shape.extents.x = 8
|
||||
set_deferred("disabled", false)
|
||||
_:
|
||||
set_deferred("disabled", true)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
extends CollisionShape2D_StateReceiver
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
func _state_physics_process_roll():
|
||||
match current_state.animation_frame:
|
||||
1,2,3,4:
|
||||
set_deferred("disabled", true)
|
||||
_:
|
||||
set_deferred("disabled", false)
|
||||
|
|
@ -20,6 +20,11 @@ const state_stamina_cost :Dictionary = {
|
|||
"ledge_climb":10
|
||||
}
|
||||
|
||||
const state_damage_amount :Dictionary = {
|
||||
"attack_sword":30,
|
||||
"attack_punch":10,
|
||||
}
|
||||
|
||||
var player_info_index :int
|
||||
var player_data :PlayerData
|
||||
|
||||
|
|
@ -62,6 +67,11 @@ func _process(delta):
|
|||
#PlayerInfo.player_stamina = stamina_component.stamina
|
||||
player_data.player_stamina = stamina_component.stamina
|
||||
|
||||
##TODO: well I'm not sure I like this but making a whole state receiver is silly
|
||||
if state_damage_amount.has(movement_state_machine.current_state.name):
|
||||
$Hitbox_Component.damage_amount = state_damage_amount[movement_state_machine.current_state.name]
|
||||
else:
|
||||
$Hitbox_Component.damage_amount = 10
|
||||
|
||||
match movement_state_machine.current_state.name:
|
||||
"idle":
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=41 format=2]
|
||||
[gd_scene load_steps=42 format=2]
|
||||
|
||||
[ext_resource path="res://lib/parent_scenes/actor.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
[ext_resource path="res://src/actors/players/playerE/PlayerE-CollisionShape2D_StateReceiver.gd" type="Script" id=31]
|
||||
[ext_resource path="res://src/actors/players/playerE/Hitbox-CollisionShape2D_StateReceiver.gd" type="Script" id=32]
|
||||
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=33]
|
||||
[ext_resource path="res://src/actors/players/playerE/Hurtbox-CollisionShape2D_StateReceiver.gd" type="Script" id=34]
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_local_to_scene = true
|
||||
|
|
@ -92,8 +93,8 @@ states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8
|
|||
|
||||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||
frames = ExtResource( 2 )
|
||||
animation = "attack-sword"
|
||||
frame = 3
|
||||
animation = "attack-punch"
|
||||
frame = 7
|
||||
script = ExtResource( 5 )
|
||||
__meta__ = {
|
||||
"_aseprite_wizard_config_": {
|
||||
|
|
@ -160,6 +161,8 @@ hurtbox_entered_function = "hit_Receiver"
|
|||
modulate = Color( 0, 0, 1, 1 )
|
||||
position = Vector2( -1, 2 )
|
||||
shape = SubResource( 2 )
|
||||
script = ExtResource( 34 )
|
||||
callable_state_machine = NodePath("../../Movement_StateMachine")
|
||||
|
||||
[node name="Interactable_Receiver" type="Node" parent="." index="11"]
|
||||
script = ExtResource( 21 )
|
||||
|
|
@ -173,7 +176,7 @@ damage_amount = 10
|
|||
|
||||
[node name="CollisionShape2D_StateReceiver" type="CollisionShape2D" parent="Hitbox_Component" index="0"]
|
||||
modulate = Color( 1, 0, 0, 1 )
|
||||
position = Vector2( -15, 14 )
|
||||
position = Vector2( 0, 8 )
|
||||
shape = SubResource( 7 )
|
||||
disabled = true
|
||||
script = ExtResource( 32 )
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user