diff --git a/src/Overlap/HurtHit_Box/Hitbox.tscn b/src/Overlap/HurtHit_Box/Hitbox.tscn index 6ca90b2..3642e2c 100644 --- a/src/Overlap/HurtHit_Box/Hitbox.tscn +++ b/src/Overlap/HurtHit_Box/Hitbox.tscn @@ -2,7 +2,9 @@ [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.gd" type="Script" id=1] -[node name="Hitbox" type="Area2D"] +[node name="Hitbox" type="Area2D" groups=[ +"hitbox", +]] script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/src/Overlap/HurtHit_Box/Hurtbox.tscn b/src/Overlap/HurtHit_Box/Hurtbox.tscn index fde26df..143d196 100644 --- a/src/Overlap/HurtHit_Box/Hurtbox.tscn +++ b/src/Overlap/HurtHit_Box/Hurtbox.tscn @@ -2,7 +2,9 @@ [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.gd" type="Script" id=1] -[node name="Hurtbox" type="Area2D"] +[node name="Hurtbox" type="Area2D" groups=[ +"hurtbox", +]] script = ExtResource( 1 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/src/Player/Player.gd b/src/Player/Player.gd index 33c4e3a..176cbd7 100644 --- a/src/Player/Player.gd +++ b/src/Player/Player.gd @@ -174,19 +174,21 @@ func roll_finished(): func _on_Hurtbox_area_entered(area): - player_stats.health -= area.damage - - if area.damage > 0: - damage_per_second += area.damage - else: - heal_per_second += abs(area.damage) + if area.is_in_group("hitbox"): + player_stats.health -= area.damage + + if area.damage > 0: + damage_per_second += area.damage + else: + heal_per_second += abs(area.damage) func _on_Hurtbox_area_exited(area): - if area.damage > 0: - damage_per_second -= area.damage - else: - heal_per_second -= abs(area.damage) + if area.is_in_group("hitbox"): + if area.damage > 0: + damage_per_second -= area.damage + else: + heal_per_second -= abs(area.damage) func _on_Stats_no_health(): diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index 5247dda..a1415d2 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -623,7 +623,10 @@ height = 6.99104 size = 12 font_data = ExtResource( 6 ) -[node name="Player" type="KinematicBody2D"] +[node name="Player" type="KinematicBody2D" groups=[ +"hero", +]] +collision_mask = 10 script = ExtResource( 1 ) FRICTION = 270 @@ -637,7 +640,7 @@ scale = Vector2( 0.5, 0.5 ) texture = ExtResource( 2 ) offset = Vector2( 0, -18 ) hframes = 60 -frame = 9 +frame = 12 [node name="Body" type="CollisionShape2D" parent="."] position = Vector2( 0.0107212, 0.0456073 )