How can I make rigidbody2d nodes be attracted to my player using gravity_point/area2D even when my character is moving?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Elliot__C

I am trying to create a game where the main concept revolves around the player having a centre of gravity that attracts enemies. The enemies would be slingshotted off the screen.

How might I achieve this? Even just a start, such as how to set out my nodes correctly would be useful. I am new to Godot and haven’t got great knowledge of the coding language. Currently, I am using rigid bodies for enemies and have an area2d node set to point gravity for the player (not the actual player node tho - that’s kinematic2d).

Anything about optimising my code would be great too if you’re feeling adventurous :slight_smile:

If you want a sample of my code, please ask