Click to See Complete Forum and Search --> : Tetris


estoyperdida
January 24th, 2008, 12:48 PM
Hiii!!
I have done this 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;



// 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:

// 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^^

Mutant_Fruit
January 24th, 2008, 01:11 PM
This is a C# programming board, not a C/C++ board.

estoyperdida
January 24th, 2008, 01:15 PM
Sorry, I Am Disaster :$

JonnyPoet
January 24th, 2008, 01:35 PM
Sorry, I Am Disaster :$???? :ehh: ???`
A disaster is when something very cathastrophic happens, who can be a disaster ???? :D 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

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.

estoyperdida
January 24th, 2008, 02:21 PM
Sorry again.
I am beginner in c, and I thought that #c and c was the same language lol. i am so embarrassed :(

JonnyPoet
January 24th, 2008, 05:39 PM
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 ?