|Topic was automatically imported from the old Question2Answer platform.
I’m currently using
KinematicBody2D to implement my Player and Enemy classes. The Enemy decides how it should move using a behavior tree, and I call
move_and_collide inside one of the leaves of the tree.
I was pretty happy with the way that this was working until I started to try and implement some of my other game mechanics. I have an
Area2D that tries to pull the
KinematicBody2D towards its center, by calling
move_and_collide every frame on any body that has entered the area.
This results in (at least) two calls to
move_and_collide per frame – one where the Enemy tries to move away from the center of the
Area2D, and another where the
Area2D tries to move the Enemy back towards its center.
Is it safe to structure things like this, or is there some built-in assumption in the way Godot works that requires me to restructure things such that
move_and_collide is only called for a given
KinematicBody2D once per frame?