Add a New Script to the Enemy. 
Keep the default functions. 
move_speed – Enemy movement speed.  
move_direction – Enemy movement direction.  
start_pos – Enemy starting position.  
target_pos – Position enemy will move to.  
@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 
move back to starting position 
Set he move_dir in the inspector to a value of your choice. 
-50 would move the enemy up and down by 50 pixels. 
Now click on the Groups section 
Add our Player node to a group 
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.