the damage system refactor!

killing is now done based on groups, the same way enemies already killed
the player.

these groups go on the entity's hitbox, not the entity itself.
enemies' hitboxes have all been put in "enemy_hitbox"

the arrow_projectile has a variable for the target group, so it could
easily be simply set to "player" for arrows shot by enemies

blocking is also done with groups. any hitbox with "blocks_arrow"
will block arrows, same with "blocks_sword" and "blocks_squash"
This commit is contained in:
Haze Weathers 2023-01-19 18:26:50 -05:00
parent 5a02d02ceb
commit a2974d8dd3
14 changed files with 102 additions and 66 deletions

View file

@ -52,15 +52,12 @@ local_coords = false
process_material = SubResource( 5 )
texture = ExtResource( 4 )
[node name="DeathTimer" type="Timer" parent="DustParticles"]
one_shot = true
[node name="Hitbox" type="Area2D" parent="." groups=["arrow"]]
collision_layer = 0
[node name="Area2D" type="Area2D" parent="." groups=["arrow"]]
visible = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( -0.5, -0.5 )
shape = SubResource( 2 )
[connection signal="timeout" from="DustParticles/DeathTimer" to="DustParticles" method="queue_free"]
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]