Help with C# Godot Course

So I’m following along with the course to the letter as I can see it though my version of Godot is 3.2.3 instead of the 3.2.2 and I was instructed to use the QueueFree() method. Everything is going along the same flow as the instructions till I add this in. Once I add that in I get an error message which stops all animation and derails me right there. I’ve tried looking up the problem and also the suggestion but I don’t know how to use call_deferred() method to full effect and was hoping I could get some help

((Error message))
E 0:00:03.229 area_set_shape_disabled: Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “area->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/physics_2d_server_sw.cpp:409 @ area_set_shape_disabled()
:0 @ void Godot.NativeCalls.godot_icall_2_420(IntPtr , IntPtr , IntPtr , Boolean )()
Node.cs:525 @ void Godot.Node.AddChild(Godot.Node , Boolean )()
bulletBrain.cs:55 @ void bulletBrain.spawnExplosion(Godot.Vector2 , System.String )()
bulletStopper.cs:26 @ void bulletStopper._on_bulletStopper_area_entered(Godot.Area2D )()

Is this some foreign problem that no one knows or something?

Sorry its taken me a little while to spot this :frowning:

not sure if it was yourself i was speaking to on Discord, but ill pop in the way i done this. hope it helps

 public void _on_explosion_area_entered(Area2D bullet)
    {
        var bulletType = (AnimatedSprite)bullet.GetNodeOrNull("AnimatedSprite");
        var explosionType = (AnimatedSprite)GetNode("AnimatedSprite");
        if (bulletType != null && (bulletType.Animation == "enemy") & (bullet is bullet))
        {
            //bulletBrain.spawnExplosion(bullet.GlobalPosition, "enemy");
            bulletBrain.CallDeferred("spawnExplosion", bullet.GlobalPosition, "enemy");
            player.addScore();
            bullet.QueueFree();
        }
    }

its been a while since i looked at the course, but there was an additional lecture added (just after the increating difficulty over time lecture ) which deals with adding the call deferred in to get round the errors that appear.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms