0 votes

the bullet which kill all zombie

func onbulletareaentered(area):

extends Area2D

func onZombiebodyentered(body):

func killthezombie():

what i did :
i make one level scene in which i take one node of zombie which have 20+ instance node of zombie scene

and every bullet will generate using preload() and instance() when i press space key

the problem is that when i shoot single zombie all zombie disappear please help me .

Thanks in advance

Godot version 3.3
in Engine by (49 points)

1 Answer

+2 votes
Best answer

the callgroup is making it so every zombie is calling killthe_zombie() on itself. You are passed in an area upon collision so you should use that to detect which zombie the bullet hit:

func on_bullet_area_entered(area):
    for zed in get_tree().get_nodes_in_group("zombie"):
        if zed == area:
by (3,870 points)
selected by

Thankyou , i am very new in
game development and even programming

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.