Example #1
0
 void Start()
 {
     boxCol = GetComponent <BoxCollider2D>();
     anim   = standing.GetComponent <playeranimator>();
     //we make sure the sliding animation for the character is deactivated
     sliding.SetActive(false);
     //we find the flash object
     flash = GameObject.Find("flash");
     //we find the main camera and pair it to cam
     cam = GameObject.Find("Main Camera");
     //we send a message to the camera with our speed.
     cam.SendMessage("receiveSpeed", speed);
     //we set the origspeed to speed so we can keep track of it while playing
     origSpeed = speed;
 }
Example #2
0
    void Start()
    {
        //this  prevents rotation against physics
        transform.GetComponent<Rigidbody2D>().fixedAngle=true;

        boxCol = GetComponent<BoxCollider2D>();
        anim = standing.GetComponent<playeranimator>();
        //we make sure the sliding animation for the character is deactivated
        sliding.SetActive(false);
        //we find the flash object
        flash = GameObject.Find("flash");
        //we find the main camera and pair it to cam
        cam = GameObject.Find("Main Camera");
        machu = GameObject.Find("backgroundmachu");
        background = GameObject.Find("backgroundback");
        clouds = GameObject.Find("clouds");

        //we send a message to the camera with our speed.
        cam.SendMessage("receiveSpeed", speed);

        //we set the origspeed to speed so we can keep track of it while playing
        origSpeed = speed;
        timeTracker = 0f;
        beginTouchTime = 0f;
        endTouchTime = 0f;
        doubleJump = 0;
        Input.multiTouchEnabled = false;
    }