Exemple #1
0
 private void GameStart()
 {
     blueberries = 3;
     print("Blueberries: " + blueberries);
     transform.localPosition = startPosition;
     rigidbody2D.isKinematic = false;
     isActive        = true;
     enabled         = true;
     salAnimation    = salAnim.Idle;
     facingDirection = facingDir.right;
     theDirectionBtn = directionBtn.none;
 }
Exemple #2
0
    void UpdateFacingDirection()
    {
        if (horizontalInput < 0 || horizontalInput > 0)
        {
            salAnimation = salAnim.Walk;
            salAnimator.Play("Walk");
        }

        // keyboard input
        if (horizontalInput < 0)
        {
            if (facingDirection != facingDir.left)
            {
                if (theDirectionBtn != directionBtn.isLeft)
                {
                    //flipX = -1;
                    FlipX();
                    theDirectionBtn = directionBtn.isLeft;
                    facingDirection = facingDir.left;
                }
            }
        }

        else if (horizontalInput > 0)
        {
            if (facingDirection != facingDir.right)
            {
                if (theDirectionBtn != directionBtn.isRight)
                {
                    //flipX = Mathf.Abs(flipX);
                    FlipX();
                    theDirectionBtn = directionBtn.isRight;
                    facingDirection = facingDir.right;
                }
            }
        }

        else
        {
            theDirectionBtn = directionBtn.none;
        }

        //print ("DirectionBtn being pressed: " + theDirectionBtn);
        //print ("Facing: " + facingDirection);
    }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     speed      = 0.05f;
     maxSpeed   = 1.0f; //not in use
     currentDir = facingDir.right;
 }
Exemple #4
0
    void UpdateFacingDirection()
    {
        if (horizontalInput < 0 || horizontalInput > 0)
        {
            salAnimation = salAnim.Walk;
            salAnimator.Play("Walk");
        }

        // keyboard input
        if(horizontalInput < 0)
        {
            if(facingDirection != facingDir.left)
            {
                if(theDirectionBtn != directionBtn.isLeft)
                {
                    //flipX = -1;
                    FlipX();
                    theDirectionBtn = directionBtn.isLeft;
                    facingDirection = facingDir.left;
                }
            }
        }

        else if (horizontalInput > 0)
        {
            if(facingDirection != facingDir.right)
            {
                if(theDirectionBtn != directionBtn.isRight)
                {
                    //flipX = Mathf.Abs(flipX);
                    FlipX();
                    theDirectionBtn = directionBtn.isRight;
                    facingDirection = facingDir.right;
                }
            }
        }

        else
        {
            theDirectionBtn = directionBtn.none;
        }

        //print ("DirectionBtn being pressed: " + theDirectionBtn);
        //print ("Facing: " + facingDirection);
    }
Exemple #5
0
 private void GameStart()
 {
     blueberries = 3;
     print ("Blueberries: " + blueberries);
     transform.localPosition = startPosition;
     rigidbody2D.isKinematic = false;
     isActive = true;
     enabled = true;
     salAnimation = salAnim.Idle;
     facingDirection = facingDir.right;
     theDirectionBtn = directionBtn.none;
 }