I have an issue with collision detection during a wall slide on a 2d platform game.
I am using the code
for i in range(get_slide_count()):
if(get_slide_collision(i).collider.get_name().find("TileDead") != -1):
but as you can hopefully see from the gif the health only decreases when right is pressed during contact with the wall, you can see near the end of the animation no direction is pressed and the health remains at 40 even though the player is in contact with the wall. I was wondering if anybody could help me work out how to decrease the health even when no direction is being pressed and the player is just sliding downwards.
Any help would be great.
Extra info (player is a kinematicbody2d, blocks are tilemaps, but this also happens with staticbody2d, the wall contact is detected with raycast2d using this script:
return next_to_left_wall() or next_to_right_wall()
return $LeftWallRaycast1.is_colliding() or $LeftWallRaycast2.is_colliding() or $LeftWallRayCast3.is_colliding()
PS - I have also asked the same question on Reddit (https://www.reddit.com/r/godot/comments/i0v00x/wall_slide_collision_issue/)