0 votes

I'm trying to make a 2.5 D shooter, and have limited development experience, Godot or otherwise. I started with a tutorial for a top-down shooter and have been modifying it for my needs. So far I've a reasonably fun prototype with both a player and enemies that can shoot at each other.

I recently started improving the tileset - square pattern, not isometric - but I've run into an issue. My character sprites have somewhat realistic proportions but the collision boxes only cover the torso. That's a hard gameplay decision as I really want to encourage precise aiming.

Interactions with the map works well enough if everything is taller than the characters. But I want to have things like tables, benches, crates, etc. that are shorter than the characters, and it doesn't work. From the top end the character's legs go clearly over/under the obstacle, and from the bottom end the character collides way too far away from it.

My preferred solution would be to have a separate collision box that's goes around the characters' feet for determining how the character interacts with the map, but does not collide with other characters or bullets.

Alternate solution is to move the collision box to the feet and displace all of the sprites - so it looks like the bullet is hitting the torso when in fact the bullet's box is lower than the bullet's sprite and hitting the feet.

Third solution is to forgo all the obstacles and just stick with tall walls.

So how painful would it be to implement the preferred solution? How jenky is the alternate solution?

Godot version Godot Engine v3.3.2
in Engine by (12 points)

1 Answer

+1 vote

I would have separate collision boxes for hit detection and collision. I think your preferred solution is the best one. It wouldn't be that painful to implement the preferred solution. At least less painful than displacing all the sprites. You just need to set up all of the collision layers properly.

by (7,190 points)

Well, it seems to be a bit harder than that. I did some searching, found somebody who had a similar problem an was able to add an Area2D with a CollisionShape2D and then fixed it with the physics layers. But, they were trying to make it so the top half of the player could hit an item for pickup.

I'm trying to make the top half of the player get hit by another object. So even when I set the layers up properly the bullet would only react with the KinematicBody2D layers and ignore the children's layer setup.

But I just changed the Area2D to a StaticBody2D and now the bullets are at least stopping. It looks like I have to refactor my hit handling, so fingers crossed, but likely the problem is solved.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.