I want to make a different movement scripts for my second player with different movement code

hello, i a newbie…i want to ask about player movement script and my english is bad…hope you understand

I want to make a 2d two players game…i watch a youtube video but he just one player…i follow him and i see he use horizontal for the movement…that mean the movement key is RightArrow , LeftArrow , A , D.

So, when i want to create the second player, i just copy the first script from the first player and when i start the game…they move in same way…when i press the left arrow, they go to same way

Somebody please help me…i need to send this game for my school competition…

I hope somebody can help me as soon as possible

first you need to modify your Input Settings.
in Edit>Project Settings>Input you will see your Input setup. find Horizontal and Vertical and delete alternative keys for them.

after then, create 2 new Input by adding 2 the displayed size at top.


Notice that two new InputAxes creatred and listed at bottom. Change their names something like HorizontalAlt and VerticalAlt.

Copy all settings from Original Horizontal and Vertical Axes except “Negative Button” and “Positive Button” Write there “a & d” & “s & w”.

duplicate your movement script. find Input.GetAxis(“Horizontal”) and change it to Input.GetAxis(“HorizontalAlt”) do the same for vertical too.

don’t forget to attach your new script to player2.

and you are good to go.

thanks you very much sir @NorthStar79