A few things:
- Are your bullets RigidBody2Ds or KinematicBody2Ds?
- Do you need separate handling for hitting different types of tiles, like different reactions for hitting walls vs hitting floors?
- Did you remember to add bodies and collision shapes to your tiles when creating your TileSet?
I made a shooter that used tile maps once, where my bullets were KinematicBody2Ds. In the script attached to the bullet scene, whenever a bullet collided with something I used the bullet's get_collider method to get the object it collided with, then used extends to check its class.
const actor_class = preload("res://scripts/actors/actor.gd")
func _fixed_process(delta):
var velocity = direction * speed * delta
move(velocity)
if is_colliding():
var collider = get_collider()
if collider extends actor_class:
collider.damage()
explode_actor()
else:
explode_wall()
queue_free()
That said, if the bullet hits a wall I believe get_collider will return the tile's StaticBody2D, and not the tile map itself. You can work out what tile got hit though using the collision's location.