need example of fps

Hi all,

Is there any chance to find an existing example of an fps game with functionality similar to HALO games. What I need is in a simple manner (e.g. in 2d) let two player play together that one players controls and drives the vehicle while other player shoots. Does anyone know any existing example of such application!

Thank you in advance!

I will assume that you already have some basic network functionality and/ or knowledge.

You could create two scripts, one being “Driver.cs”, the other being “Shooter.cs”. Basically you attach these scripts to a gameobject (your vehicle) and you disable both scripts.

Make sure Driver.cs contains the controls for steering the vehicle, and that Shooter.cs gives you the controls for shooting. (Oh, they dont have to be in C#, can be Boo or Unityscript aswell)

Then make a new script, call it PlayerInit.cs or something and attach this to the same gameObject. Basically what you need to do in that script is to enable either the Driver.cs or the Shooter.cs. So, edit our PlayerInit.cs script: (this example is in C#)

// We define the scripts and assign them a variable
Driver driverScript;
Shooter shooterScript;

void Awake() {
// We call this function on Awake, we get the components Driver and Shooter of this gameobject.
driverScript = GetComponent<Driver>();
shooterScript = GetComponent<Shooter>();
}

void Start() {
// Basically we are going to randomly enable one of the scripts for the local player
int i = Random.Range(0, 2);
if (i = 0){
driverScript.enabled = true;}
else if (i = 1){
shooterScript.enabled = false;}
}

So you have an object, which you should synchronize over the network, and when a player joins, he is randomly given control over either the Driving or the Shooting. You will want to adjust this script, since it is very basic, but I hope it helps you start.

there is not really a example of a game made like that, i’m currently doing something similar like vehicles and fps player, you know you could of just start looking at the car and vehicles tutorials here on the forums, and the rest you will probably see on youtube the fps tutorials