All Questions

Community

G
Aditya Gupta

Player not killed

I am using Godot 3.2. Whenever the enemy touches my player, it gets killed but the player is still alive. Also, the debugger shows the following error: body_set_shape_disabled: can't change the state while flushing queries. Use call_deferred() or set_deferred() to change the monitoring state instead. When I pushed the stomp_detector's collision shape area a little back, the enemy touches player but it doesn't kill it. Is this an engine related problem?
  • G
    Aditya Gupta replied

    I fixed the error by replacing:get_node("CollisionShape2D").disabled = true

    with:

    call_deferred("set",get_node("CollisionShape2D").disabled,true)


    but the player is still not getting killed when it touches the enemy (below stomp area).

  • G
    Aditya Gupta replied

    I fixed it by reshaping the collisionshape2D on both player and enemy.

  • A
    MAzer replied

    My Player wouldn't die! .. I have tried to change sizes of CollisionShape2D on Player and Enemy with no success. The player is on player and world layers and collides with Enemy and world layer.

    I have used this code but it is not working.

    func _on_EnemyDetector_body_entered(body: Node) -> void:

    queue_free()

    I don't get PhysicsBody2D as on the tutorial. Is that the result of using a different GODOT version?

  • Nathan Lovato replied

    Could you upload your Godot project as a .zip archive? I will look at what is causing the issue. It could be a missing signal connection, or something else.

    I don't get PhysicsBody2D as on the tutorial. Is that the result of using a different GODOT version?

    You should get Node as a type hint. It's a minor change the developers made just before releasing Godot 3.2. But the body you get is still a physics body.

    I updated the first lesson about collisions a few days ago to explain that... but already forgot which one it was. 😅

  • A
    MAzer replied

    https://drive.google.com/drive/folders/11SGpjw755L6SgrQSy-kKtEhvOMmfW7r4?usp=sharing


  • Nathan Lovato replied

    Yes, you need to upload it to a service of your choice. A cloud hosting service, wetransfer, anything you like.

  • Nathan Lovato replied

    Here is the problem: in the Player scene, you set the Monitoring property of the EnemyDetector to false. If your area isn't monitoring, it means it won't detect collisions or anything. Checking the checkbox next to Monitoring makes the character die when it touches the enemy.

  • A
    MAzer replied

    Thank you Nathan.. It worked.

  • Nathan Lovato replied

    Glad we could solve this!

  • L
    Leonardo Lindarte replied

    I'm having the same issue, can you please help me out checking out the problem? Here it is the github link:


    https://github.com/GamesAtHome/GodotPlatformerTutorial