Fix and expand hurtbox component.

This commit is contained in:
Nitsud Yarg 2024-06-02 13:18:56 -07:00
parent 8597840033
commit 1a743214d7
4 changed files with 30 additions and 11 deletions

View File

@ -1,13 +1,10 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[sub_resource type="RectangleShape2D" id=148] [ext_resource path="res://src/components/Hurtbox_Component.gd" type="Script" id=1]
extents = Vector2( 11.5, 14.5 )
[node name="Hurtbox_Component" type="Area2D"] [node name="Hurtbox_Component" type="Area2D"]
collision_layer = 16 collision_layer = 16
collision_mask = 128 collision_mask = 128
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [connection signal="body_entered" from="." to="." method="_on_Hurtbox_Component_body_entered"]
self_modulate = Color( 1, 0, 0, 1 )
position = Vector2( 0, -4 )
shape = SubResource( 148 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=2] [gd_scene load_steps=26 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/enemyC/enemyC_movement_component.gd" type="Script" id=2] [ext_resource path="res://src/enemyC/enemyC_movement_component.gd" type="Script" id=2]
@ -107,6 +107,9 @@ animations = [ {
"speed": 10.0 "speed": 10.0
} ] } ]
[sub_resource type="RectangleShape2D" id=22]
extents = Vector2( 10, 16 )
[sub_resource type="RectangleShape2D" id=21] [sub_resource type="RectangleShape2D" id=21]
extents = Vector2( 9, 3.5 ) extents = Vector2( 9, 3.5 )
@ -117,7 +120,7 @@ actor_type = "Enemy"
position = Vector2( 11, -7 ) position = Vector2( 11, -7 )
frames = SubResource( 20 ) frames = SubResource( 20 )
animation = "idle" animation = "idle"
frame = 0 frame = 1
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
"layer": "", "layer": "",
@ -156,6 +159,10 @@ animation_sequence = [ "attack" ]
[node name="move" parent="movement_state_machine" index="3"] [node name="move" parent="movement_state_machine" index="3"]
animation_sequence = [ "walk" ] animation_sequence = [ "walk" ]
[node name="CollisionShape2D" parent="Hurtbox_Component" index="0"]
position = Vector2( -1, -2 )
shape = SubResource( 22 )
[node name="EdgeDetection" type="RayCast2D" parent="." index="6"] [node name="EdgeDetection" type="RayCast2D" parent="." index="6"]
modulate = Color( 0.054902, 1, 0, 1 ) modulate = Color( 0.054902, 1, 0, 1 )
show_behind_parent = true show_behind_parent = true

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=90 format=2] [gd_scene load_steps=91 format=2]
[ext_resource path="res://src/playerC/Player-KinematicBody2D.gd" type="Script" id=1] [ext_resource path="res://src/playerC/Player-KinematicBody2D.gd" type="Script" id=1]
[ext_resource path="res://src/playerC/states/idle.gd" type="Script" id=2] [ext_resource path="res://src/playerC/states/idle.gd" type="Script" id=2]
@ -414,6 +414,9 @@ animations = [ {
[sub_resource type="RectangleShape2D" id=74] [sub_resource type="RectangleShape2D" id=74]
extents = Vector2( 14, 18.5 ) extents = Vector2( 14, 18.5 )
[sub_resource type="RectangleShape2D" id=149]
extents = Vector2( 10.5, 16.5 )
[node name="Player" type="KinematicBody2D"] [node name="Player" type="KinematicBody2D"]
collision_layer = 2 collision_layer = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -507,6 +510,11 @@ animation_suffix = true
[node name="Hurtbox_Component" parent="." instance=ExtResource( 12 )] [node name="Hurtbox_Component" parent="." instance=ExtResource( 12 )]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox_Component"]
modulate = Color( 1, 0, 0, 1 )
position = Vector2( 0.5, -3.5 )
shape = SubResource( 149 )
[node name="Gun" type="Position2D" parent="."] [node name="Gun" type="Position2D" parent="."]
physics_interpolation_mode = 1 physics_interpolation_mode = 1
position = Vector2( 25, -5 ) position = Vector2( 25, -5 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2] [gd_scene load_steps=18 format=2]
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1] [ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2] [ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2]
@ -44,13 +44,15 @@ animations = [ {
[sub_resource type="RectangleShape2D" id=74] [sub_resource type="RectangleShape2D" id=74]
extents = Vector2( 14, 18.5 ) extents = Vector2( 14, 18.5 )
[sub_resource type="CircleShape2D" id=82]
[node name="ActorTemplate" type="KinematicBody2D"] [node name="ActorTemplate" type="KinematicBody2D"]
collision_layer = 2 collision_layer = 2
script = ExtResource( 8 ) script = ExtResource( 8 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] [node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 75 ) frames = SubResource( 75 )
frame = 1 frame = 4
playing = true playing = true
flip_h = true flip_h = true
__meta__ = { __meta__ = {
@ -96,4 +98,9 @@ idle_node = NodePath("../idle")
[node name="Hurtbox_Component" parent="." instance=ExtResource( 1 )] [node name="Hurtbox_Component" parent="." instance=ExtResource( 1 )]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox_Component"]
modulate = Color( 1, 0, 0, 1 )
position = Vector2( -1, 1 )
shape = SubResource( 82 )
[node name="SE_Player" type="AudioStreamPlayer" parent="."] [node name="SE_Player" type="AudioStreamPlayer" parent="."]