Can i queue() anything? (or, how do i turn off physics?)

Godot Version

4.3 beta 2

Question

Problem 1: If two enemies are on top of each other, one bullet kills both. i don’t want that but both trigger the Area2D so i’m not sure how to stop it.

Problem 2: i want to turn off the collider inside Area2D entered event. i tried self.process_mode = Node.PROCESS_MODE_DISABLED but Godot says no, you can’t modify physics inside a physics method. You can queue things to run after (queue_free(), queue_redraw()) so i’m wondering if i can queue arbitrary code?

Bullet collides. i want the bullet to stick around (to play sounds and animations) but i don’t want it visible or colliding anymore.

call_deferred and set_deferred are how to “queue” arbitrary code.

Properties must be by node path

set_deferred("process_mode", Node.PROCESS_MODE_DISABLED)

While functions can use dot notation as a Callable

free.call_deferred() # hey that's queue_free!
1 Like

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