Search Unity

Game Like BlockOut

Discussion in 'Scripting' started by killerz, Feb 3, 2011.

  1. killerz

    killerz

    Joined:
    Aug 28, 2010
    Posts:
    32
    Hi all, i'm making a game like blockout (http://www.youtube.com/watch?v=20sKKvLwZ7s) but i have problems with phyisic, can anyone help me with this game. I want to make a grid movement like it.


    Please help me
     
  2. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    If by 'physics' you mean that you're using Unity's physics system, that's probably part of the problem right there. (There's no need to use the built-in physics system for something like this, and in fact it will likely just get in your way.)
     
  3. killerz

    killerz

    Joined:
    Aug 28, 2010
    Posts:
    32
    Yes, i can't use Unity Physics
     
  4. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    You'll want to use a 3-d array for this (either an actual 3-d array, or a 1-d array with mapped indices).

    The intermediate block rotations are purely cosmetic and don't affect the gameplay, so they should be handled separately. (In fact, I'd recommend implementing the game without them first, and then adding them in later.)

    The game logic is basically the same as Tetris, but with an extra dimension. The logic for Tetris has been discussed quite a bit in various places (in particular, you might search the forum archives on gamedev.net for relevant threads). The logic is actually a little less straightforward to get right than you might expect (IMO), but I'm sure you can get whatever help you need with that on this and other similar forums.

    Beyond that, I'd recommend narrowing your question down a bit (that is, explain in more detail what exactly you need help with).
     
  5. killerz

    killerz

    Joined:
    Aug 28, 2010
    Posts:
    32
    i want to make a fields Vector3 Array, and manage all positions for cube, i tryed with for cycle but i didn't have good results. Example:

    var fields : Vector3[];

    function Start()
    {
    fields = new Vector3[63];
    }

    function assingVectors()
    for (a=0; a=63; a++)
    {
    for ( i=0 ; i>3; i++)
    {
    for(j=0 ; j>3; j++)
    {
    for(z=0; z>3;z++)
    {
    fields[a]= Vector3(i;j;z);
    }
    }
    }
    }
    }
     
  6. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    There's a number of basic syntax and logical errors in your code example. My personal recommendation would be to spend a little more time going through tutorials and so forth, and then maybe start with something a little simpler than what's shown in the video you linked to. (Although the game appears straightforward, implementing the behavior shown would actually be fairly involved and would require a certain level of comfort with basic programming concepts such as arrays, loops, and logical flow. Starting with something that's simpler conceptually would give you an opportunity to get more comfortable with those concepts.)

    As for your code though, the first thing I'd do is make sure it compiles. Try to compile it in Unity, and fix any errors that are generated until it compiles cleanly. The you can move on to fixing the logical errors.
     
  7. killerz

    killerz

    Joined:
    Aug 28, 2010
    Posts:
    32
    Ehi, yes there are errors because i make this code on forum , no by script. But i resolved it with this code:
    var a : int = 0;

    for ( i=0 ; i<4; i++)
    {
    for(j=0 ; j<4; j++)
    {
    for(z=0; z<4;z++)
    {
    fields[a++]= Vector3(i,j,z);
    }
    }
    }
     
  8. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    Yes, that looks better.

    So do you know how to proceed from there? Or do you have other questions?
     
  9. killerz

    killerz

    Joined:
    Aug 28, 2010
    Posts:
    32
    no, for now i don't have other problems. Thanks for your interest ;)
     
  10. jlivingstonsg

    jlivingstonsg

    Joined:
    Aug 22, 2012
    Posts:
    6
    Did you make a working BlockOut game?
     
  11. jlivingstonsg

    jlivingstonsg

    Joined:
    Aug 22, 2012
    Posts:
    6
    Hi.
    I managed to make a browser version of Blockout and now it work for phone browser with swipe.

    https://blockout.nu

    Is it ok?

    MagI
     
    Last edited: Apr 5, 2021
  12. jlivingstonsg

    jlivingstonsg

    Joined:
    Aug 22, 2012
    Posts:
    6
    Can I try your version?