this is in GameViewController.m
-(void)fillMutablePath{
CGPoint movePoint = CGPointFromString([pointsToFillArray objectAtIndex:0]);
CGPathMoveToPoint(fillPath, NULL, movePoint.x, movePoint.y);
for (int i=0; i<[pointsToFillArray count]; i++) {
CGPoint tempPoint = CGPointFromString([pointsToFillArray objectAtIndex:i]);
CGPathAddLineToPoint(fillPath, NULL, tempPoint.x, tempPoint.y);
CGContextAddPath(gameViewObj._myContext, fillPath);
CGContextFillPath(gameViewObj._myContext);
if(CGPathContainsPoint(fillPath, nil, "What goes here?", false)){
[self doDie];
}
else {
CGContextFillPath(gameViewObj._myContext);
}
CGPathRelease(fillPath);
[pointsToFillArray removeAllObjects];
}
}
This is in GameView.m
-(CGPoint) GetBirdPosition:(CGPoint) PtPoint :(int) BirdNumber{
CGPoint Temp=PtPoint;
BOOL isTouch=TRUE;
while (isTouch)
{
isTouch=FALSE;
if(playField[(int) Temp.x][(int) Temp.y]==2)
{
isTouch=TRUE;
if(playField[(int) Temp.x+1][(int) Temp.y] == 2 || playField[(int) Temp.x-1][(int) Temp.y] == 2)
{
pos[BirdNumber].y = -pos[BirdNumber].y;
Temp.y+=pos[BirdNumber].y;
}
else if(playField[(int) Temp.x][(int) Temp.y+1] == 2 || playField[(int) Temp.x][(int) Temp.y-1] == 2)
{
pos[BirdNumber].x = -pos[BirdNumber].x;
Temp.x+=pos[BirdNumber].x;
}
}
}
return Temp;
}
-(void)flyingBird:(NSTimer *)timer {
if(appDelegate.gameStateRunning == YES){
for (int i=0; i< [birdImageViewArray count];i++)
{
UIImageView* birdImageView=[birdImageViewArray objectAtIndex:i];
CGPoint Temp=CGPointMake(birdImageView.center.x + pos[i].x , birdImageView.center.y + pos[i].y);
birdImageView.center =[self GetBirdPosition:Temp:i];
if(playField[(int) birdImageView.center.x][(int) birdImageView.center.y]==3){
[[NSNotificationCenter defaultCenter] postNotificationName:@"LineCrossed" object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"PlayDieSound" object:nil];
}
}
}
}
I can't figure out what goes in the place where I wrote "what goes here"?? I want it so that if a bird is trapped within the shape, then [doDie] takes place. If the bird is not trapped within the shape, it gets filled in. Any ideas are greatly appreciated.