From 4f668f94d9361c3e3443f0140f5f0e938ee01777 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sun, 20 Nov 2022 17:10:09 -0300 Subject: [PATCH] make player able to hit block from below --- scenes/player/Player.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scenes/player/Player.cs b/scenes/player/Player.cs index 2b1ed0c..f09eda2 100644 --- a/scenes/player/Player.cs +++ b/scenes/player/Player.cs @@ -87,6 +87,14 @@ public class Player : KinematicBody2D { _eventBus.EmitSignal("PlayerTouched"); } + else if (collider.IsInGroup("Block") && Vector2.Down.Dot(collision.Normal) > 0) + { + if (collider.HasMethod("Hit")) + { + collider.RemoveFromGroup("Block"); + collider.CallDeferred("Hit"); + } + } collision.Dispose(); } }