make arrows collide with dynamic objects (closes #61)

This commit is contained in:
Haze Weathers 2023-03-22 13:28:16 -04:00
parent 83a06510e5
commit 0c9528c7c1
4 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ shader = ExtResource( 2 )
shader_param/border_color = Color( 0, 0, 0, 1 ) shader_param/border_color = Color( 0, 0, 0, 1 )
shader_param/border_corners = true shader_param/border_corners = true
[node name="Rock" instance=ExtResource( 1 )] [node name="Crate" instance=ExtResource( 1 )]
[node name="Sprite" parent="." index="0"] [node name="Sprite" parent="." index="0"]
material = SubResource( 1 ) material = SubResource( 1 )

View file

@ -15,7 +15,7 @@ extents = Vector2( 3.7, 4 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 4, 4 ) extents = Vector2( 4, 4 )
[node name="Rock" type="KinematicBody2D" groups=["pushable"]] [node name="Rock" type="KinematicBody2D" groups=["pushable", "stop_arrow"]]
collision_layer = 4 collision_layer = 4
script = ExtResource( 3 ) script = ExtResource( 3 )

View file

@ -30,7 +30,7 @@ func _physics_process(delta):
#Wall Collision #Wall Collision
func _on_Hitbox_body_entered(body): func _on_Hitbox_body_entered(body):
if breaks_on_wall: if breaks_on_wall:
if body is TileMap or body is StaticBody2D: if body is TileMap or body is StaticBody2D or body.is_in_group("stop_arrow"):
_make_sparks() _make_sparks()
_persist_trail() _persist_trail()
queue_free() queue_free()

View file

@ -46,6 +46,7 @@ scale_amount_random = 0.25
scale_amount_curve = SubResource( 3 ) scale_amount_curve = SubResource( 3 )
[node name="Hitbox" type="Area2D" parent="." groups=["arrow"]] [node name="Hitbox" type="Area2D" parent="." groups=["arrow"]]
collision_mask = 5
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( -0.5, -0.5 ) position = Vector2( -0.5, -0.5 )