body_enter being signaled on load (without a body entering)

Having a funny problem.

I have a KinematicBody2D and an Area2D.

extends KinematicBody2D

func _ready():
    add_to_group("players")
    set_fixed_process(true)
    pass
extends Area2D

var equipped = false

func _ready():
    connect("body_enter",self,"_on_body_enter")
    connect("body_exit",self,"_on_body_exit")
    pass

func _on_body_enter(body):
    if not equipped and body.is_in_group("players"):
        print("enter")
    pass

When the game first runs, the output immediately prints "enter", even though they aren't close to touching. Once I move the KinematicBody2D through the Area2D, it prints again as it should.

I'm using Godot 2.1.4 stable.

Any help is appreciated! I'm totally stumped.

Answers

  • rjoshuarjoshua Posts: 37Member

    This is very extrange. Can you upload your project to examine it?

  • targetcreaturetargetcreature Posts: 2Member

    I'm such a bonehead. Finally found that same script attached to another node. But I found it by cleaning up the project to upload! So in that way you've saved the day. Thanks :)

  • rjoshuarjoshua Posts: 37Member

    ha, ha, don't worry. I'm glad I could help. :)

Sign In or Register to comment.