make player able to hit block from below

This commit is contained in:
Chris Cromer 2022-11-20 17:10:09 -03:00
parent 6fc89f832c
commit 4f668f94d9

View File

@ -87,6 +87,14 @@ public class Player : KinematicBody2D
{ {
_eventBus.EmitSignal("PlayerTouched"); _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(); collision.Dispose();
} }
} }