Untitled

 avatar
unknown
plain_text
a year ago
3.7 kB
25
Indexable
public int dropSet = 1;
    public int preDropSet = 0;
    private bool Falling = true;
    private bool Rotating = true;
    public bool Spawn = false;
    public Color[] puyo;
    public GameObject [] puyo2;
    int puyotypeIndex;

    void Start()
        {   if (Spawn == true)
                {Instantiate(puyo2[puyotypeIndex], new Vector2 (-12.5f, 5f),puyo2[puyotypeIndex].transform.rotation);}

        }

    void Update() {    
        if (Falling == true)
            {if (transform.eulerAngles.z == 0)
                transform.Translate (0, -0.01f, 0);
            if (transform.eulerAngles.z == 90)
                transform.Translate (-0.01f, 0, 0);
            if (transform.eulerAngles.z == 180)
                transform.Translate (0, 0.01f, 0);
            if (transform.eulerAngles.z == 270)
                transform.Translate (0.01f, 0, 0);}

        if (Input.GetKeyDown(KeyCode.X)) {
            if (Rotating == true) 
                if (transform.position.x > -14.5)
                    if (transform.position.x < -9.5)
            {
                transform.Rotate (0, 0, 90);
            }
        }

        if (Input.GetKeyDown(KeyCode.Z)) {
            if (Rotating == true) 
                if (transform.position.x > -14.5)
                    if (transform.position.x < -9.5)
            {
                transform.Rotate (0, 0, -90);
            }
        }

        if (Input.GetKey(KeyCode.LeftArrow))
            if (transform.position.x > -14.5) {
                if (Falling == true)
                    if (transform.eulerAngles.z == 0)
                        {transform.Translate(-0.5f, 0, 0);}}
        if (Input.GetKey(KeyCode.LeftArrow))    
            if (transform.position.x > -14) {
                if (Falling == true)
                    if (transform.eulerAngles.z == 90)
                        {transform.Translate(0, 0.5f, 0);}}
        if (Input.GetKey(KeyCode.LeftArrow))    
            if (transform.position.x > -14.5) {
                if (Falling == true)
                    if (transform.eulerAngles.z == 180)
                        {transform.Translate(0.5f, 0, 0);}
        if (Input.GetKey(KeyCode.LeftArrow))    
            if (transform.position.x > -14) {
                if (Falling == true)
                    if (transform.eulerAngles.z == 270)
                        {transform.Translate(0, -0.5f, 0);}
            }
        }

        if (Input.GetKey(KeyCode.RightArrow)) {
            if (transform.position.x < -9.5) {
                if (Falling == true) 
                    if (transform.eulerAngles.z == 0)
                        {transform.Translate(0.5f, 0, 0);}}
        if (Input.GetKey(KeyCode.RightArrow))    
            if (transform.position.x < -10) {
                if (Falling == true) 
                    if (transform.eulerAngles.z == 90)
                        {transform.Translate(0, -0.5f, 0);}}
        if (Input.GetKey(KeyCode.RightArrow))    
            if (transform.position.x < -9.5) {
                if (Falling == true)     
                    if (transform.eulerAngles.z == 180)
                        {transform.Translate(-0.5f, 0, 0);}}
        if (Input.GetKey(KeyCode.RightArrow))    
            if (transform.position.x < -10) {
                if (Falling == true) 
                    if (transform.eulerAngles.z == 270)
                        {transform.Translate(0, 0.5f, 0);}
            }
        }
    }

    void OnTriggerEnter2D (Collider2D Other)
    {
        Falling = false;
        Rotating = false;
        Spawn = true;
    }
}
Editor is loading...
Leave a Comment