

#import "Menu.h"
#import "GameScene.h"
#import "HowToPlay.h"
#import <AVFoundation/AVFoundation.h>

@implementation Menu
{
    
    SKLabelNode * playBtn;
    SKLabelNode * Instructions;
}


-(void)didMoveToView:(SKView *)view
{
        SKSpriteNode * bg = [SKSpriteNode spriteNodeWithImageNamed:@"Capa.png"];
        bg.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
        [self addChild:bg];
    
    playBtn = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"];
    playBtn.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)-100);
    playBtn.text = @"Play";
    playBtn.fontSize = 60;
    
    [self addChild:playBtn];
  
    
    Instructions = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"];
    Instructions.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)-200);
    Instructions.text = @"How to Play";
    Instructions.fontSize = 60;
    
    [self addChild:Instructions];
        
}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch *touch in touches)
    {
        CGPoint location       = [touch locationInNode:self];
        
        
        if([playBtn containsPoint:location])
        {
            
            
            GameScene         * inu = [[GameScene alloc]initWithSize:self.size];
            inu.scaleMode = SKSceneScaleModeAspectFill;
            SKTransition *transition = [SKTransition fadeWithDuration:1];
            [self.view presentScene: inu transition:transition];
            
        
            
        }
        
        if([Instructions containsPoint:location])
        {
            
            
            HowToPlay         * inu = [[HowToPlay alloc]initWithSize:self.size];
            SKTransition *transition = [SKTransition fadeWithDuration:1];
            inu.scaleMode = SKSceneScaleModeAspectFill;
            [self.view presentScene: inu transition:transition];
            
            
            
        }
    }


}




@end
