Add a New Script to the Enemy.

Keep the default functions.

We need variables for:

@export lets us see variables in the inspector

In the ready function we can set the start and target positions

In the process function we:

move enemy to target position

when they reach target:

move back to starting position

Setting initial values

Set he move_dir in the inspector to a value of your choice.

-50 would move the enemy up and down by 50 pixels.

Detecting Collisions

Go to the Player node

Click on the Node tab

Now click on the Groups section

Add our Player node to a group

Return to the Enemy Node

Choose the Signals tab

Add the body_entered signal and connect it.

Now check for a collision with the player in the code

Now you can develop your level further by dragging in enemies in strategic places.