Hey guys!
I get the following error message on all 4 cases in the switch function:
error: incompatible type for argument 1 of 'movePiece:inDirectionX:inDirectionY:withAnimation :
why is that?
(I tried to google for the issue but couldnīt find anything.)
Code:
-(void) movePiece:(UIImageView *)brickgrid withAnimation:(BOOL) animate{
NSLog(@"MovePiece");
switch ( [self validMove:brickgrid] ) {
case UP:
[self movePiece:brickgrid
inDirectionX:0 inDirectionY:-1 withAnimation:animate];
break;
case DOWN:
[self movePiece:brickgrid
inDirectionX:0 inDirectionY:1 withAnimation:animate];
break;
case LEFT:
[self movePiece:brickgrid
inDirectionX:-1 inDirectionY:0 withAnimation:animate];
break;
case RIGHT:
[self movePiece:brickgrid
inDirectionX:1 inDirectionY:0 withAnimation:animate];
break;
default:
break;
}
}
I also get the following error message on the
-(void) movePiece: (UIImageView)brick inDirectionX: (NSInteger) dx inDirectionY: (NSInteger) dy withAnimation: (BOOL) animate{ part
error: can not use an object as parameter to a method
Any suggestions?
Code:
-(void) movePiece: (UIImageView)brick inDirectionX: (NSInteger) dx inDirectionY: (NSInteger) dy withAnimation: (BOOL) animate{
(I havenīt done this part yet)
}
The
-(void) movePiece: (UIImageView *)brickgrid withAnimation: (BOOL) animate retrieves information from this method
Code:
-(void) getPieceAtPoint:(CGPoint) point{
CGRect touchRect = CGRectMake(point.x, point.y, 1.0, 1.0);
NSLog(@"getPieceAtPoint");
for (int y = 0; y < BRICKHEIGHT; y++){
for (int x = 0; x < BRICKWIDTH; x++){
if( CGRectIntersectsRect([grid[x][y] frame], touchRect) ){
[self movePiece:grid[x][y] withAnimation:YES];
NSLog(@"X: %d" , x);
NSLog(@"Y: %d" , y);
}
}
}
}
Thanx in advance!