Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Hadi_makes_games · Jun 12, 2020 at 02:19 PM · tetris

7 bag tetris not working

its not spawning my code is

 using UnityEngine;
 using System.Collections;
 
 
  string GetRandomTetromino ()
      {
  
          if (IUsed == true && LUsed == true && JUsed == true && OUsed == true && SUsed == true && ZUsed == true && TUsed == true) {
  
              IUsed = false;
              LUsed = false;
              JUsed = false;
              OUsed = false;
              SUsed = false;
              ZUsed = false;
              TUsed = false;
  
          }
  
          int randomTetromino = Random.Range(1, 8);
  
          // This string is used to define the location of the next Tetromino.
          string randomTetrominoName = "Prefabs/J";
  
  
  
          // This switch is used to get a random Tetromino out of 7.
          // NOTE: This needs to be modified to have a 7-bag randomiser later.
          switch (randomTetromino)
          {
  
              case 1:
                  if (TUsed == false) {
                      randomTetrominoName = "Prefabs/T";
                      TUsed = true;
                      
                  }
  
                  break;
  
              case 2:
                  if (SUsed == false) {
                      randomTetrominoName = "Prefabs/S";
                      SUsed = true;
                      
                  }
  
                  break;
  
              case 3:
                  if (LUsed == false) {
                      randomTetrominoName = "Prefabs/L";
                      LUsed = true;
                      
                  }
  
                  break;
  
              case 4:
                  if (JUsed == false) {
                      randomTetrominoName = "Prefabs/J";
                      JUsed = true;
                      
                  }
  
                  break;
  
              case 5:
                  if (IUsed == false) {
                      randomTetrominoName = "Prefabs/I";
                      IUsed = true;
                      
                  }
  
                  break;
  
              case 6:
                  if (ZUsed == false) {
                      randomTetrominoName = "Prefabs/Z";
                      ZUsed = true;
                      
                  }
  
                  break;
  
              case 7:
                  if (OUsed == false) {
                      randomTetrominoName = "Prefabs/O";
                      OUsed = true;
                      
                  }
  
                  break;
              
  
          }
  
          // Return the location of the next Tetromino specified by the switch.
          return randomTetrominoName;
  
      }
      public void spawnNext() {
     // Random Index
 string i = (GameObject)Instantiate(Resources.Load(GetRandomTetromino(), typeof(GameObject)), new Vector2(5.0f, 20.0f), Quaternion.identity);
 
     // Spawn Group at current Position
     
 }
 void Start() {
     // Spawn initial Group
     spawnNext();
 }

i copied from another what is wrong?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

126 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Array out of index, but shouldn't be 2 Answers

How can I set a standard camera resolution size for my 2D game [Beginner] 0 Answers

Wow Unity Devs. Just wow 0 Answers

Problem retrieving transform.position after parent rotation 0 Answers

Can anyone tell me how to store a block in a grid of a Tetris game . Help 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges