Sorry for the incredibly un-descriptive title, but I don't even know what's wrong.
I am trying to make it so that when a peg is selected it disappears, if there are 20 pegs on the board (pegsLeft.) Then if there aren't 20 pegs left on the board I want to application to show possible peg moves. I can get the peg to remove when selected with the board full, but that is it. Can someone diagnose whats wrong with my code...
I am trying to make it so that when a peg is selected it disappears, if there are 20 pegs on the board (pegsLeft.) Then if there aren't 20 pegs left on the board I want to application to show possible peg moves. I can get the peg to remove when selected with the board full, but that is it. Can someone diagnose whats wrong with my code...
Code:
-(IBAction)moveCrossPeg1 {
if (pegsLeft == 20) {
crossPeg1.hidden = YES;
crossPeg1.enabled = NO;
pegsLeft = pegsLeft - 1;
pegsLeftLabel.text = [NSString stringWithFormat:@"Pegs Remaining: %i",pegsLeft];
}
if ((pegsLeft < 20) && (crossPeg7.enabled == NO) && (crossPeg3.enabled == YES)) {
crossPeg7.enabled = YES;
crossPeg7Choose = YES;
UIImage *editPeg = [UIImage imageNamed:@"editpeg.png"];
[crossPeg7 setImage:editPeg forState:UIControlStateNormal];
[editPeg release];
}
}
-(IBAction)moveCrossPeg7 {
if (pegsLeft == 20) {
crossPeg7.hidden = YES;
crossPeg7.enabled = NO;
pegsLeft = pegsLeft - 1;
pegsLeftLabel.text = [NSString stringWithFormat:@"Pegs Remaining: %i",pegsLeft];
}
if ((pegsLeft < 20) && (crossPeg1.enabled == NO) && (crossPeg3.enabled == YES)) {
crossPeg1.enabled = YES;
crossPeg1Choose = YES;
UIImage *editPeg = [UIImage imageNamed:@"editpeg.png"];
[crossPeg1 setImage:editPeg forState:UIControlStateNormal];
[editPeg release];
[self goToCross];
}
}