Search Unity

The Curious Case of Tetris Game

Discussion in '2D' started by alxandro18, Mar 5, 2015.

  1. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12
    Hello,

    I'm working on a project of tetris . I rely on the tutorial http://noobtuts.com/unity/2d-tetris-game and seems to work.

    Controls work well , the edges too ( were somewhat failing me at the beginning ) but now it happens that when I run the game While not in the parts inside the Grid The spawner in your script says "missing object"

    but if I put the pieces within the limits of the grid , the part that generates colque and spawner interact with controls and sometimes overlap ! D:

    someone who can help me?

    upload caps :) pieces into the grid.png fhsfgh.png gral.png missing obkect spawner.png


    thank you all for your time to read my
     
    Last edited: Mar 6, 2015
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,405
    Just a random guess,
    Maybe you have assigned those groups from scene Hierarchy (and they got destroyed),
    should assign them form Prefabs (project) folder, into those spawner fields..
     
    alxandro18 likes this.
  3. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12

    I'll try and notify! :D Thanks
     
  4. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12
    Eureka!
    if it worked prefab linking a group spawner . but now shows me several Recent Messages in red on the console. Furthermore , it appears that the pieces do not fit together as if they pass near each other not even reach the floor tetrisfdg.png
     
  5. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12
    anyone?
     
  6. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    The tutorial has some issues, like not testing if it's actually looking inside the array. Find the line it's complaining about by double-clicking the error in the console, and wrap it in a check for the height. It'll probably require something like:
    Code (CSharp):
    1. if(v.y < h)
    2. {
    3.     // Check the grid here
    4. }
    5.  
    I'm not sure about the placement issue. It looks like you're either putting down the block groups off by 0.5, or have shifted the borders by 0.5. Stick a few Debug.Log() calls here and there to verify that you actually use non-fractional positioning (as the tutorial is designed to do).
     
    alxandro18 likes this.
  7. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12
    as part of "//check the grid here" would write ? i dont know, i am beginner... im sorry :/
     
  8. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Just put the if-statement around the line with the error. Sandwich that line between the curly braces :)

    If unsure, post the method causing the problem here.
     
    alxandro18 likes this.
  9. alxandro18

    alxandro18

    Joined:
    Feb 21, 2015
    Posts:
    12
    not fit the pieces :(

    any idea?...
    capultimate.png