I have a big script for a game which combines little scripts
The lines which should move the characters(2 player on 1 computer)
are including some variable and there is a problem with two of them, the script:
void Update () {
if (Input.GetKey (KeyCode.W))
P1.transform.Translate (new Vector2 (0, P1speed * Time.deltaTime));
if (Input.GetKey (KeyCode.S))
P1.transform.Translate (new Vector2 (0, -P1speed * Time.deltaTime));
if (Input.GetKey (KeyCode.A))
P1.transform.Rotate (new Vector3 (0,0, P1rotspeed * Time.deltaTime));
if (Input.GetKey (KeyCode.D))
P1.transform.Rotate (new Vector3 (0,0, -P1rotspeed * Time.deltaTime));
float translation = Input.GetAxis("Vertical") * P2speed;
float rotation = Input.GetAxis("Horizontal") * P2rotspeed;
translation *= Time.deltaTime;
rotation *= Time.deltaTime;
P2.transform.Translate(0, translation, 0);
P2.transform.Rotate(0, 0, -rotation);
Thats not the whole script just the lines of the character movement.
The problem is that the variables P1speed and P2speed affecting each other if P2speed is bigger than Player1 moves faster,when they are the same(3),Player1 still moves faster.
Player1 is controlled with WASD and Player 2 is controlled with a 4 axis joystick.
By the way what do you think wahts better: one big script to controll every thing or 8 little?(2for P1 and P2 movement 2 for P1 and P2 health etc.)