_on_RigidBody2D_body_entered signal doesn't work

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BarbOn

For a side scroller game i need variuous scene ( main , player , weapon, enemy ).
In the script of the main one, I instance them with “add_child” and they spawn correctly on the screen with their variables.
Now i want to add collision to player, bullet and enemy that are all RigidBody2D with their CollisionShape2D.

This is the code for the Enemy

extends RigidBody2D

var life = 250

func _ready():
    get_node("Timer").start()
    pass
func _on_weapon_body_entered(body):
    if body.is_in_group("weapon"):
	    life=life-body.damage
    else:
	    life=life+1
    pass


func _on_Timer_timeout():
    get_node("Label").text=String(life)
    get_node("Timer").start()
    pass

In the weapon scene there is a group called weapon

What is the problem?

:bust_in_silhouette: Reply From: flurick

First thing first, is the _on_weapon_body_entered() connected to anything? Maybe share the project so we get some context?

Is connected to the father RigidBody2D (so the enemy)

Here’s the project:
MEGA

BarbOn | 2019-03-16 17:40