Godot Version
v4.3 stable
Question
Hi guys!
I’m developing a game and I’m having trouble setting up collision detection between a tower and an enemy.
Game structure (https://github.com/kliver985/endless-override):
- enemy.gd: script responsible for the enemy.
- tower.gd: script responsible for the tower.
- range_area.gd: script for the tower’s range (using Area2D).
- range_component.gd: script for collision detection and range logic.
The idea is that when an enemy enters the turret’s range (range_area), the system detects the collision and the turret can attack him. However, the collisions are not being detected correctly. The enemy enters the turret’s radius, but nothing happens - the signals (body_entered, area_entered) are not being fired as expected.
What I’ve already checked:
- The turret and the enemy have CollisionShape2D properly configured.
- The CollisionLayers and CollisionMasks seem to be correct (turret on layer 1, enemies on 2, and vice versa in the masks).
- The turret’s range (range_area) is active and has a connected signal.
- I’ve tested with monitoring = true and monitorable = true.
- No errors are displayed on the console.
Question:
What else can I check to ensure that the collision between the enemy and the tower works correctly? Any tips on how to debug this kind of problem? Is it possible that some component is getting in the way of detection without me realizing it?
If anyone has experienced this or can help me identify what I’m missing