0 votes

Hello, I programmed a bullet that disappears when hitting a door, but it only works with the second bullet and so on, why not with the first shot?

Here is my code:

extends Sprite

onready var player = get_tree().get_root().get_node("World/Player")
var velocity = Vector2()

func _ready():
    $Area2D.connect("body_entered", self, "on_Area2D_entered")

func _process(delta):

func move(delta):
    global_position += velocity * delta

func on_Area2D_entered(body):
    if body.name == "Player":
        player.alive = false
    elif body.is_in_group("doors"):
in Engine by (24 points)

I cannot see anything wrong with your code! Can you provide an example project?

Please log in or register to answer this question.

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.