How to set up a second player ?(side scroller)

I want to have 2 players in a sidescroller project. One is controlled via WASD and the other via the Arrows. How can I add the second player and his controls? I have only found tutorials for online multiplayer and blueprints only.

Hello Croatoan,

I assume that you’re setting up your controls using the Input bindings in Project Settings. If this is the case, you can have a MoveForward (W and S) and a MoveRight (A and D) for the first player, and a MoveForwardP2 (UpArrow and DownArrow) / MoveRightP2 (LeftArrow and RightArrow) for the second player. When you go to make the Player Controller blueprint, you can essentially copy the Player Controller for the first player but change what the Input events are.

I hope this helps!

Hi! I have the same problem. I deceded not to create another topic that is why I writing it here. The thing the same I need 2 players (objects) that can be controled for example the 1st one via WASD and the 2nd one via the Arrows, but I need it done with Blueprints because c++ code is hard for me now. I really, really have tried to do it on my own. I have spend 4-5 hours trying to do it. I couldn’t do it and it bothers me because this thing must be so simple and I need this feature in my game. So, the problem is like I have one blueprint that can be controlled via WASD, i make dublicate of it, paste the copy on the level, run the game and now only duplicate is moving the 1st one stands still. The thing is only the bluprint last added on the level works. If there are 10 player blueprints on a level, only last will be controllable.
Could you please try to create in UE 4.9.1 this 2 players feature? It is not hard or take more time. I think professional can make it in 3 minutes. One just need a controllable blueprint that works via WASD and make a duplicate of WASD Blueprint and try to control both blueprints on a level.

PS. Thank you and sorry for my english!

Hello UE3-4,

The reason you’re only able to control one character is because you’re technically controlling the playercontroller, which is only set to give input to the actor that it is possessing. If you wish to give input to multiple characters with only one actual playercontroller, you’ll need to place all of the logic inside of the playercontroller itself.

Below is an image of a small thing I put together to allow for another character to be controlled. This was done in the Side Scroller template. I duplicated the SideScrollerCharacter BP and named the new one SideScrollerCompanion. This code uses the Get All Actors of Class node to find all of the instances in the level of the SideScrollerCompanion class, storing them in an array. The two events below that expect input based off what I set up myself in the project settings to move the SideScrollerCompanion instances. There are other ways to do this, but this was a quick thing to put together

Hope this helps!

Thank you for help! This will help many developers.I will try this way. But I checked this post too late. After 3 hours or thinking I finnaly did it myself but I think I ran into a bug or I just did it all wrong. I am making a mobile game so the option “Use mouse for touch” in project settings->Engine->Input is enabled that means that the 2 virtual joysticks are always on the game screen. Version of UE is 4.9.1. Split screen option is disabled. I create a controlable blueprint “BP_player”. In setting of the Game Mode blueprint "BP_player’ is set as a player.So now the engine knows which blueprint is the player. So I use the “create player” block and I get the second player (that is copy of “BP_player”) on my screen. That is what i need. But there is a little problem in the game. After creating the second player there are 4 virtual joysticks on the screen (instead of two)

That is fine I still can control players via joysticks. But this is a little inconvenient to see 4 joysticks on the screen. If kill the second player then 2 joysticks will be kill as well and everything goes back to normal. The question is. Is that a bug or I am doing something wrong?

It is not a really local or network multiplayer. In my game a man control 2 players/objects in game at once. So left virtual joystick controls 1st player and the right joystick controls the second player. And everything is fine exept 4 joysticks insteat of two. So just wanted to know is that a bug or something else.

If you’re planning to have two different players on a mobile game and don’t plan to do splitscreen, you may want to use Multiplayer settings in the PIE (Play In Editor) settings. This will end up creating multiple windows for every extra character and will also spawn a second character when the game begins.

In this case, you would want to use a single PlayerController for both characters. You can set up input events for the left stick to control the 1st character and then separate input events for the right stick to control the second player. When using a single PlayerController, you should only be getting one set of analog sticks.