Try this

..
mail@pastecode.io avatar
unknown
csharp
a month ago
849 B
1
Indexable
Never
void OnTriggerEnter2D(Collider2D Other)
{
    if (Spawn == false)
    {
        // Place spawning logic outside of the loop
        Instantiate(puyo2[puyotypeIndex], new Vector2(-12.5f, 5f), puyo2[puyotypeIndex].transform.rotation);
        Spawn = true;
        dropSet++;
    }

    // Handle collisions based on layers
    if (Other.gameObject.layer == 3 || Other.gameObject.layer == 2)
    {
        Falling = false;
        Rotating = false;
        Left = false;
        Right = false;
        Spawn = false;
    }
    else if (Other.gameObject.layer == 4)
    {
        Falling = true;
        Rotating = true;
        Left = true;
        Right = false;
        Spawn = false;
    }
    else if (Other.gameObject.layer == 5)
    {
        Falling = true;
        Rotating = true;
        Left = false;
       
Leave a Comment