## How to get part of code to work

Member
Posts: 75
Joined: 2009.01
Post: #1
Hi.
I am currently working on a game and am trying to figure out how part of it to work.
There are 6 different colored square pieces.
If you "somehow" line them up vertically or horizontally of the same type of piece (color) with atleast 3, they will disappear and give you points.

This is all the code I could come up with and was wondering if it would work, and if it did, how to hook it up and put the code together.

Code:
```- (void) removeRedBlocks {           enum x           {                     3, 4, 5, 6, 7, 8           }           enum y           {                     3, 4, 5, 6, 7, 8           }           int removeRedBlock[x][y] }```

lol, I know the code above is pretty straightforward and probably doesnt work and all that.
I'm just trying to get to the point.
So, what do you all think?
Any help would be MUCH appreciated.
Thanks.

BTW: I set each color piece to a number in my header file like so:
enum PIECE
{
REDBLOCK = 1,
BLUEBLOCK = 2,
ect
}

What I'm trying to do is, if the column is 3 and row is 1, then it can equal either 3, 6, 9, 12 and so on.
If it equals 3, then it means it was the REDBLOCK and those 3 red blocks should disappear and give appoints.
One problem i'm running into is, I cant get the 1 row or 1 column since I put 3-8 int the enum x and y.
Member
Posts: 749
Joined: 2003.01
Post: #2

You need to review the basics of C programming, "for" loops, "if" statements.

Also I could not understand how the blocks are placed. How many blocks are there? are they on a 2D grid? How wide is the grid?

Quote:What I'm trying to do is, if the column is 3 and row is 1, then it can equal either 3, 6, 9, 12 and so on.
If it equals 3, then it means it was the REDBLOCK and those 3 red blocks should disappear and give appoints.
One problem i'm running into is, I cant get the 1 row or 1 column since I put 3-8 int the enum x and y.

I can't understand any of this.

The first thing about programming is manage to think-express what you want to do as clearly as possible.

Â©hâ‚¬ck Ã¸ut Âµy stuÆ’Æ’ Ã¥t ragdollsoft.com