This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I am trying to turn off my Player child node area2D Hurtbox via function to make the player invincible. The function call is triggered by an animation which calls it on a frame.

On my Player.gd:

onready var hurtbox = $Hurtbox

  func roll_invincibility_started():
        hurtbox.set_deferred("monitoring", false)

I have tried a few things instead of hurtbox.set_deferred such as

  get_node("Hurtbox").monitoring == false

How can I do it?

Godot version 3.5
in Engine by (12 points)

code is incorporated correctly. Make sure your ANimationPlayer calls this function using print

Kindly, could you show a code snippet of which is correct? get_node or my first snippet?

Regarding having AnimationPlayer call the function using print, you have lost me there. I have set it up as a call method track on the animation player so that the function would be called on a specific frame.

1 Answer

+1 vote

both methods of disabling monitoring are correct.
Thus, there must be another issue preventing this from happening.
By doing :

func roll_invincibility_started():
        print("methodcalled")
        hurtbox.set_deferred("monitoring", false)

You will ensure if your method is actually called from this animation frame

by (8,188 points)
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.