Search Unity

Creating a movement same like game : JAWS UNLEASHED

Discussion in 'Works In Progress - Archive' started by Boeing®, Jun 1, 2013.

  1. Boeing®

    Boeing®

    Joined:
    Apr 12, 2013
    Posts:
    8
    Hi. i want to create a game like JAWS UNLEASHED. then i realize that my movement is not good i wandering if i can create movement like JAWS UNLEASHED



    thanks,sorry for my bad english.
     
  2. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    this is a great game, and its very underrated. Loved every minute of it!

    what are u gonna use the movement for?
     
  3. Boeing®

    Boeing®

    Joined:
    Apr 12, 2013
    Posts:
    8
    I use This Code in my game :

    //JAVA SCRIPT\\

    private var jumpSpeed:float = 15.0;
    private var gravity:float = 15.0;
    private var runSpeed:float = 5.0;
    private var walkSpeed:float = 10.0;
    private var rotateSpeed:float = 50.0;

    private var grounded:boolean = false;
    private var moveDirection:Vector3 = Vector3.zero;
    private var isWalking:boolean = false;
    private var moveStatus:String = "idle";

    static var dead : boolean = false;

    function Update ()
    {

    if(dead == false) {





    // Only allow movement and jumps while grounded
    if(grounded) {
    moveDirection = new Vector3((Input.GetMouseButton(1) ? Input.GetAxis("Horizontal") : 0),0,Input.GetAxis("Vertical"));

    // if moving forward and to the side at the same time, compensate for distance
    // TODO: may be better way to do this?
    if(Input.GetMouseButton(1) Input.GetAxis("Horizontal") Input.GetAxis("Vertical")) {
    moveDirection *= .7;

    }

    moveDirection = transform.TransformDirection(moveDirection);
    moveDirection *= isWalking ? walkSpeed : runSpeed;

    moveStatus = "idle";
    if(moveDirection != Vector3.zero)
    moveStatus = isWalking ? "walking" : "running";

    // Jump!
    //if(Input.GetButton("Jump"))

    if (Input.GetKeyDown(KeyCode.Space))

    moveDirection.y = jumpSpeed;
    }

    // Allow turning at anytime. Keep the character facing in the same direction as the Camera if the right mouse button is down.
    if(Input.GetMouseButton(1)) {
    transform.rotation = Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0);
    } else {
    transform.Rotate(0,Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime, 0);

    }






    // Toggle walking/running with the T key
    //if(Input.GetKeyDown("t"))
    //isWalking = !isWalking;




    //Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;


    //Move controller
    var controller:CharacterController = GetComponent(CharacterController);
    var flags = controller.Move(moveDirection * Time.deltaTime);
    grounded = (flags CollisionFlags.Below) != 0;


    }


    if(Input.GetMouseButton(1) || Input.GetMouseButton(0)) {
    //Screen.lockCursor = true;

    Screen.showCursor = false;


    //var mouse1 = Input.mousePosition.y;
    //var mouse2 = Input.mousePosition.x;

    }

    //Vector3 mousePos = Input.mousePosition;
    else {
    //Screen.lockCursor = false;
    Screen.showCursor = false;

    //Input.mousePosition.y = mouse1;
    //Input.mousePosition.x = mouse2;

    //Input.mousePosition = mousePos;

    }


    }

    @script RequireComponent(CharacterController)




    I now is not nerby the movement like game JAWS UNLEASHED.
     
  4. Boeing®

    Boeing®

    Joined:
    Apr 12, 2013
    Posts:
    8
    i gonna use for my game
     
  5. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    ok im just curious waht kind of game it is, what ur character is and so on.

    Im an artist so the code is like reading swahili to me:p
     
  6. Boeing®

    Boeing®

    Joined:
    Apr 12, 2013
    Posts:
    8
    my CHARACTER is a shark But now i using a humpback whale model because my shark is unfinished.
     
  7. alexandersiamandi

    alexandersiamandi

    Joined:
    Dec 19, 2014
    Posts:
    1
    that code isn't working ghnjy,jnj,n