0 votes

Hi. I am a beginner to godot and am making a game with it. For some reason, my enemies disappear on game startup despite the fact that I positioned them in the editor. This is my project: https://github.com/Ripple-Studios/Godot-Wild-Jam-36-Game-Ripple-Studios


Godot version 3.3.2
in Engine by (19 points)

the link no exist..

Sorry, I made the repository public now

1 Answer

0 votes
Best answer

I think the problem is that it collides with itself, I don't know why you put 2 colliders on the tree. Also in the script, in the function function _on_Area2D_body_entered (body): in the last lines you use body.queue_free () and queue_free (), and as it collides with itself it is deleted. I leave comments:

extends KinematicBody2D

var motion = Vector2()

var Health = 100

var bullet = preload("res://Art/Bullet.png")
var explosion = load("res://Particles.tscn").instance()
var bulletSpeed = 1000
func _ready():
func _process(delta):
    if Health <= 0:

func _physics_process(delta):
    var world = get_parent()
    var Player = world.get_node("Player")

    position += (Player.position - position)/40


func _on_Area2D_body_entered(body):

    Health -= 20
    #body.queue_free() # D E L E T E 
    #queue_free() # D E L E T E

┠╴CollisionShape2D # DELETE THIS
┃ ┖╴CollisionShape2D

by (2,252 points)
selected by

Thank you! I fixed it by adding an if statement to check that it is not itself colliding.

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.