What would be a practical way for moving multiple rockets in the described way (2D Game)

I am currently developing a 2D endless runner game. One of the obstacles are rockets flying from the right edge of the screen to the left. The missiles spawn outside the camera view and move constantly to the left on the x-axis. As long as the missiles are outside the camera view they should behave as shown in the picture. The rockets follow the y-position of the player in a slowed way. The y-position of the rocket closest to the player’s y-position should follow the player’s y-position. The other rockets should then each be positioned with a slightly offset y-position above/below the player’s y-position. So if the player moves up/down the missile that is targeted directly at the players y-position can change. If a missile reaches the edge of the screen, it should not change its y-position anymore and is no longer considered for the behavior described above.

If my description is unclear or there are any other areas of confusion, I will try to add to explanations as best I can.

Thanks for any ideas how I could implement this behavior.

You could compare the y position of the rockets relative to the player, and then choose the closest to be the reference point. You could then change the Y coordinate of the rockets by a limited amount towards the player’s y position based on the reference rocket. Each rocket could compare its relative position to the reference rocket and then move itself a set offset away.