From 797a1332528f434e29124c6b9f53396cb0d1b6db Mon Sep 17 00:00:00 2001 From: Luna Brovchuk Date: Sun, 1 Oct 2023 17:50:54 +0200 Subject: [PATCH] Make Separate Hitbox For Trash --- src/models/enemies/ghost/Ghost.tscn | 2 +- src/models/player/Player.tscn | 10 ++++++++-- src/models/player/player.gd | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/models/enemies/ghost/Ghost.tscn b/src/models/enemies/ghost/Ghost.tscn index 6b9e743..13e0c74 100644 --- a/src/models/enemies/ghost/Ghost.tscn +++ b/src/models/enemies/ghost/Ghost.tscn @@ -25,7 +25,7 @@ flip_h = true use_parent_material = true frames = ExtResource( 1 ) animation = "idle" -frame = 3 +frame = 4 playing = true centered = false diff --git a/src/models/player/Player.tscn b/src/models/player/Player.tscn index fd3499f..c8e71a8 100644 --- a/src/models/player/Player.tscn +++ b/src/models/player/Player.tscn @@ -5,7 +5,7 @@ [ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 3.5, 3.5 ) +extents = Vector2( 4, 4 ) [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 7, 11 ) @@ -77,7 +77,7 @@ playing = true centered = false [node name="WallCollision" type="CollisionShape2D" parent="."] -position = Vector2( 11.5, 20.5 ) +position = Vector2( 11, 20 ) shape = SubResource( 1 ) [node name="EnemyCollision" type="Area2D" parent="."] @@ -86,6 +86,12 @@ shape = SubResource( 1 ) position = Vector2( 12, 12 ) 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="."] autoplay = "RESET" anims/RESET = SubResource( 4 ) diff --git a/src/models/player/player.gd b/src/models/player/player.gd index 4e89145..8d68373 100644 --- a/src/models/player/player.gd +++ b/src/models/player/player.gd @@ -96,7 +96,7 @@ func _physics_process(delta): if recharge_timer <= get_recharge(): recharge_timer += delta - var areas = $EnemyCollision.get_overlapping_areas() + var areas = $DirtCollision.get_overlapping_areas() slowed = false for area in areas: if area.get_parent().is_in_group("trash_drop"):