Godot Version
4.4
Question
Hello! I’m creating my first game in Godot, like a shortened-down version of the Tanks game from Wii Play. I’m having issues figuring out how to get bullets to know that they’re colliding with walls.
I have a scene for a player tank, a scene for bullets, and a scene for a basic level (which is comprised of a single TileMapLayer for now). The “wall” tiles successfully stop the player from moving past - that was easy to set up simply by turning on a single physics layer between the player and the wall tiles.
My issue is that I don’t know how to achieve the collisions I’m looking for with the bullets. The bullet is an Area2D with a CollisionShape2D and a Sprite2D. I want to know when a bullet hits a wall, and have the bullet ricochet. Is there a way to do this with the TileMapLayer? Do I need to program the wall to signal to the bullet? Do I need to have the bullet detect that what it’s hit is a wall tile, and then ricochet itself? Is it some other answer entirely, requiring me to use scenes instead of tiles or something?
I’m lost. I’ve been working on this for a while and this is a roadblock where I’ve found little in terms of helpful resources. Any help is appreciated