Copying game mechanics from other games. Legal or not?

I think its safe, unless apple or ms copyrighted it. However it is really hard to copytight idea.

So if you do not copy everything from other game (together with movement, artstyle etc.) you are quite safe, your game could be inspired by and not copy of that other one.

Most nowadays shooters “borrowed” most ideas for quake, unreal 99 and other older games, so they cannot sue you for stuff they stole.

If you are making dangerously close clone of some game, use uncle goole, research how far you can go.