2014-09-18 5 views
0

Quand j'écriserreur avec le code touchesBegan

@implementation GameViewController 

-(IBAction)StartGame:(id)sender{ 

    StartGame.hidden = YES; 

    BirdMovement = [NSTimer scheduledTimerWithTimeInterval:0.05 
    target:self selector:@selector(BirdMoving) userInfo:nil repeats:YES]; 

} 

-(void)BirdMoving{ 

    Bird.center = CGPointMake(Bird.center.x, Bird.center.y - BirdFlight); 

    BirdFlight = BirdFlight - 5; 

    if (BirdFlight < -15) { 
     BirdFlight = -15; 

     if (BirdFlight > 0) { 
      Bird.image = [UIImage imageNamed:@"3.png"]; 

     } 

     if (BirdFlight < 0) { 
      Bird.image = [UIImage imageNamed:@"4.png"]; 
     } 

} 


-(void)touchesBegan:(NSSet *)touches withEvent: (UIEvent *)event{ 

    BirdFlight =30; 

} 

il est dit que j'utilise un identificateur non déclaré touchesBegan: S'il vous plaît aidez-moi :)

+0

Vous devez mettre en retrait votre code de quatre espaces pour le formater correctement sur stackoverflow. –

Répondre

0

Vous avez oublié la fermeture accolade droite (}) pour la déclaration en if (BirdFlight < -15) votre méthode BirdMoving.

Dans Xcode, choisissez Edition> Sélectionner tout (ou appuyez sur ⌘ A). Ensuite, choisissez Editeur> Structure> Réintrent (ou appuyez sur contrôleI). Cela rendra le problème évident.