Make Separate Hitbox For Trash

main
Luna Brovchuk 2023-10-01 17:50:54 +02:00
parent 3175d16cbd
commit 797a133252
3 changed files with 10 additions and 4 deletions

View File

@ -25,7 +25,7 @@ flip_h = true
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 3 frame = 4
playing = true playing = true
centered = false centered = false

View File

@ -5,7 +5,7 @@
[ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3] [ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 3.5, 3.5 ) extents = Vector2( 4, 4 )
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 7, 11 ) extents = Vector2( 7, 11 )
@ -77,7 +77,7 @@ playing = true
centered = false centered = false
[node name="WallCollision" type="CollisionShape2D" parent="."] [node name="WallCollision" type="CollisionShape2D" parent="."]
position = Vector2( 11.5, 20.5 ) position = Vector2( 11, 20 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="EnemyCollision" type="Area2D" parent="."] [node name="EnemyCollision" type="Area2D" parent="."]
@ -86,6 +86,12 @@ shape = SubResource( 1 )
position = Vector2( 12, 12 ) position = Vector2( 12, 12 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="DirtCollision" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="DirtCollision"]
position = Vector2( 11, 20 )
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "RESET" autoplay = "RESET"
anims/RESET = SubResource( 4 ) anims/RESET = SubResource( 4 )

View File

@ -96,7 +96,7 @@ func _physics_process(delta):
if recharge_timer <= get_recharge(): if recharge_timer <= get_recharge():
recharge_timer += delta recharge_timer += delta
var areas = $EnemyCollision.get_overlapping_areas() var areas = $DirtCollision.get_overlapping_areas()
slowed = false slowed = false
for area in areas: for area in areas:
if area.get_parent().is_in_group("trash_drop"): if area.get_parent().is_in_group("trash_drop"):