Why does spawnPuyoScript.fall = true whenever the puyo rotates?

public bool Spawn = true;
    public bool Fall = true;
    public bool Rotate = true;
    public bool Left = true;
    public bool Right = true;
    public int dropSet = -1;
    public bool next1 = true;
    public bool next2 = true;
    public GameObject puyo;
    public GameObject puyoSpawn;
    public float gameStart = 0;
    public float transition = 0;
    public SpawnPuyoScript spawnPuyoScript;
    public ColorScript colorScript;
    public Customization customization;
    void Start()
    {

    }

    void Update()
    {
        gameStart = Time.time;
        transition = Time.time;

        if (Fall == true)
        {
            transform.position -= new UnityEngine.Vector3(0, 0.001f, 0);
        }

        if (Fall == false)
        {
            transform.position -= new UnityEngine.Vector3(0, 0, 0);
        }

        if (Rotate == true)
            if (Input.GetKeyDown(KeyCode.X))
            {
                transform.eulerAngles += new UnityEngine.Vector3(0, 0, 90);
                if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 90)))
                    transform.position -= new UnityEngine.Vector3(0.5f, 0, 0);
                else if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 180)))
                    transform.position += new UnityEngine.Vector3(0.5f, 0, 0);
                else if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 270)))
                    transform.position += new UnityEngine.Vector3(0.5f, 0, 0);
                else
                    transform.position -= new UnityEngine.Vector3(0.5f, 0, 0);
            }

        if (Left == true)
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                transform.position -= new UnityEngine.Vector3(1, 0, 0);
            }

        if (Right == true)
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                transform.position += new UnityEngine.Vector3(1, 0, 0);
            }
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == 2)
        {
            spawnPuyoScript.Spawn = true;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            this.gameObject.tag = "Finish";
        }

        if (other.gameObject.layer == 3)
        {
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
        }

        if (other.gameObject.layer == 4)
        {
            Fall = true;
            spawnPuyoScript.Spawn = false;
            Rotate = true;
            Left = true;
            Right = true;
            this.gameObject.tag = "Respawn";
        }

        if (other.gameObject.layer == 5)
        {
            Fall = false;
            Rotate = false;
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -1;
        }

        if (other.gameObject.layer == 6)
        {
            Fall = false;
            Rotate = false;
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -1;
        }

        if (other.gameObject.layer == 7)
        {
            spawnPuyoScript.Spawn = true;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = 1;
            this.gameObject.tag = "Finish";
        }

        if (other.gameObject.layer == 8)
        {
            spawnPuyoScript.Spawn = false;
            Fall = true;
            Rotate = true;
            Left = true;
            Right = false;
        }

        if (other.gameObject.layer == 9)
        {
            spawnPuyoScript.Spawn = false;
            Fall = true;
            Rotate = true;
            Left = false;
            Right = true;
        }

        if (other.gameObject.layer == 10)
        {
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -3;
        }

        if (other.gameObject.tag == "Not Falling")
        {
            Debug.Log("Caramel");
        }
    }

Time to start debugging your coe!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

I used debugging, but couldn’t find the issue.

That just means you didn’t finish debugging.

Again, understand what you INTEND to do.

Now understand what your code is ACTUALLY doing.

Until you can at least do that and isolate the point in the code where things go wrong, there’s not much anyone else can do because we’re not even running your code or your project.

Again, debugging. You will know when you are done debugging when you both understand what you want, AND understand where in your code it goes astray.

That is debugging.

1 Like