Generating Hit Results?

Godot Version

4.2.2

Question

Hi all,

Now I am up to something that I have no idea how to do in Godot. It was something that was so trivial that I did in Unity and so easy I forgot how it was done.

So, I was trying to do it on my own in Godot and have ran into a problem.

The thing is this, I can pick up a bomb with a key press - move it - and drop somewhere else with another key press. The idea was simple when I drop the “bomb”, it animates and a sound is generated. Then after that the game was to generate a list of bodies and then make some of the bodies that meet certain criteria to be destroyed/or use queue.free in Godot.

The bomb is created like this:

The outer layer being the area I need for any hits.

So, I used this code in one of the functions:

	    #trying to get a list of all item in collision radius
		var bodies = bomb_collision_area.get_overlapping_bodies();
		var i=0;
		for body in bodies:
			i+=1;
			print(str(i) + ": " + str(body) );
		#play animation of the explosion

And it is only generating two bodies, the hero, and one of the tiles maps. Where I drop the bomb is shown here on the game map showing how many hits there should be at least 3 tilemaps, and the player, which is in the vicinity when it is dropped - so a minimum of 4 hits.

If anyone can come up with a way of making all these objects result in a hit here is a big thankyou in advance.

Regards.

You’re not hitting three different TileMaps, but the same TileMap three times! So the behavior is correct. Since the individual cells of a TileMap aren’t individual nodes, they won’t appear here. If you want to find out which exact cells of the TileMap were hit, you have to unfortunately calculate that by yourself.

Aha - so that’s the reason. I knew it would be something simple. Just couldn’t figure out why. I don’t need the tilemap cells I need them there in the end - just the objects that are replacing them that need to be destroyed

But now that you have mentioned that … nah, it’ll be fine the way it is :stuck_out_tongue:.

Thanks for your help.

Regards.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.