CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Tetris

  1. #1
    Join Date
    Jan 2008
    Posts
    3

    Tetris

    Hiii!!
    I have done this code:
    Code:
    typedef struct strBlock
    {
       int x; //Position board
       int y;
    } Block;
    
    /* The structure Card, is a form with four blocks */ 
    typedef struct strCard
    {
       int type;
       Block Bl[4];  //Each card is 4 blocks
    } Card;
    Code:
    // movement of block down
    void downblock(block * l)
    {
       int i;
       for(i=0;i<4;i++)
          l->Bl[i].y++;
    }
    But I think that this part is wrong:
    Code:
    // movement of left block
    void leftblock(block * l)
    {
       int i;
       for(i=0;i<4;i++)
          l->Bl[i - 1].y++;
    }
    
    // movement of right block
    void rightblock(block * l)
    {
       int i;
       for(i=0;i<4;i++)
          l->Bl[i + 1].y++;
    }
    someone can help me?
    Thanks^^

  2. #2
    Join Date
    May 2007
    Posts
    1,546

    Re: Tetris

    This is a C# programming board, not a C/C++ board.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  3. #3
    Join Date
    Jan 2008
    Posts
    3

    Re: Tetris

    Sorry, I Am Disaster :$

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Tetris

    Quote Originally Posted by estoyperdida
    Sorry, I Am Disaster :$
    ???? ???`
    A disaster is when something very cathastrophic happens, who can be a disaster ???? I'm confused.
    If the code should be C++ its still agaist the rules of how to write code.
    But if it should be C# then I would suggest reread a starter book. This will have lots of compiler errormessages so if you need help to get this run point out the errormessages and on which lines they occure. So we can help you.
    ome very general is a) use public, internal, private or proteced keywords for each method you create
    b) params of methods needs to be declared
    Code:
    private void downblock(Block block )
    {
       int i;
       for(i=0;i<4;i++)
    	  l->Bl[i].y++;
    }
    // warning used variable block as input for  a method.
    So please look which forum you need then post there or correct the issue so we know whats with your post. The word 'disaster ' doesn't give me any info.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #5
    Join Date
    Jan 2008
    Posts
    3

    Re: Tetris

    Sorry again.
    I am beginner in c, and I thought that #c and c was the same language lol. i am so embarrassed

  6. #6
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Tetris

    Quote Originally Posted by estoyperdida
    Sorry again.
    I am beginner in c, and I thought that #c and c was the same language lol. i am so embarrassed
    I see. And why when you are a beginner not starting in C# ? Easy to learn, great futured managed .net language. Multithreadable, no real disadvantage to C. C itself is legacy IMHO or do you talk about managed C++ ? There are so muc languages named very similar now so you need to be very carefully in searching for the right Forum and learning the needed language. Or is it that your teacher told you you have to learn C ?
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured