void Right()
 {
     flip.flipNow(true);
     motion.MoveRight(0.5f, speed);
     if (onGround())
     {
         motion.impactForce(0, 10);
     }
 }
Exemple #2
0
    void Inputs()
    {
        // movement
        if (Input.GetKey(KeyCode.A))
        {
            // if(btnControls.left){

            if (onMG)
            {
                motion.MoveLeft(0.5f, mgSpeed);
            }
            else if (onIce)
            {
                motion.MoveLeft(0.005f, normalSpeed);
            }
            else
            {
                motion.MoveLeft(0.05f, normalSpeed);
            }

            flip.flipNow(false);
            run = true;

            if ((x > -1f) && onGround)
            {
                Inst(dust);
            }
        }
        else if (Input.GetKey(KeyCode.D))
        {
            // else if(btnControls.right){

            if (onMG)
            {
                motion.MoveRight(0.5f, mgSpeed);
            }
            else if (onIce)
            {
                motion.MoveRight(0.005f, normalSpeed);
            }
            else
            {
                motion.MoveRight(0.05f, normalSpeed);
            }

            flip.flipNow(true);
            run = true;

            if ((x < 1f) && onGround)
            {
                Inst(dust);
            }
        }
        else
        {
            if (onMG)
            {
                motion.noMotion(0.5f, mgSpeed);
            }
            else if (onIce)
            {
                motion.noMotion(0.005f, normalSpeed);
            }
            else
            {
                motion.noMotion(0.05f, normalSpeed);
            }

            run = false;
        }
        // Jump
        if (Input.GetKeyDown(KeyCode.Space) && onGround)
        {
            // if(btnControls.up&&onGround){
            btnControls.up = false;
            Inst(jumpDust);
            motion.impactForce(0, 50);
        }
        // Smash
        if (Input.GetKeyDown(KeyCode.S) && !onGround)
        {
            // if(btnControls.down&&!onGround){
            btnControls.down = false;
            Inst(spark);
            motion.impactForce(0, -50);
            smash = true;
        }
        else if (IsGround(2))
        {
            StartCoroutine(smashPause());
        }
        // Smash pause
        if (smash && onGround)
        {
            cam.GetComponent <Camera>().shack = true;
        }
    }
Exemple #3
0
 void Right()
 {
     flip.flipNow(true);
     motion.MoveRight(0.5f, speed);
 }