void FixedUpdate() { if (alive && ruleManager.GameRunning()) { if (virtualJoystick.x < 0) { facing_left = true; } else if (virtualJoystick.x > 0) { facing_left = false; } addForce(virtualJoystick.x, virtualJoystick.y); } addForce(virtualJoystick.x, virtualJoystick.y); if (horizontal != 0 && vertical != 0) // Check for diagonal movement // limit movement speed diagonally, so you move at 70% speed { horizontal *= moveLimiter; vertical *= moveLimiter; } this.addForce(horizontal, vertical); }