Easier than expected

After finishing the Gravity script I began looking into split screen (which I find much more fun than online multi-player and feel should make a come back).

SplitScreen
Use the viewport rectangle properties to change how much of the display this camera takes up. X and Y are the coordinates of the bottom left corner of the view. W and H are the width and height.

The actual act of making a split screen view is very simple. Just add another camera into the scene and tweak the values of each to cover the amount of the window you want covered.

Input manager
The same controls have been duplicated, with the numbers corresponding to the player number that will be using them.

The control system is a little more complex and, from what I have seen, less documented. The idea of course is that you need to be able to distinguish between the controller giving input and ensure each character responds to only their player. Unity has an input manager, which can be found under Edit->Project Settings->Input, that maps buttons to commands such as jump, shoot, enter and movement axis. From what my brief search returned, the simplest way to handle multiple characters is to duplicate controls and change the input method. In the controls script a player number is set up and combine this with the input commands to ensure only the correct controller is being accessed.

In other news I’m also going to be dabbling more into the new additions to the SpelunkBots API, so expect a new post about that soon.

Advertisements