Hello!
I'm trying to connect a pointer from one .m file to another but it doesn't seem to recoqnize it.
For example....
I'm trying to connect my a pointer from my main menu.m to my Game.m. it get's successfully build but it still doesn't seem to access that pointer.
What am I forgetting or doing wrong?
Thanks in advance!
MainMenu.h
Code:
BOOL NewGame;
@property (nonatomic) IBOutlet BOOL NewGame;
MainMenu.m
Code:
//Reset playerscore and gamestate
-(IBAction)NewGame{
NewGame = YES; //Should be recognized from the Game.m file
[audio stop];
audio.numberOfLoops = 0;
[audio release];
NSLog(@"New");
back.hidden = YES;
newgame.hidden = YES;
continuegame.hidden = YES;
korridor1.hidden = NO;
fackla.hidden = YES;
Start.hidden = YES;
option.hidden = YES;
howtoplay.hidden = YES;
SFXimage.hidden = YES;
Musicimage.hidden = YES;
[UIView beginAnimations:@"korridor_1.png" context:nil];
[UIView setAnimationDuration:1];
korridor1.transform = CGAffineTransformMakeScale(13,13);
korridor1.alpha = 1.0f;
[UIView commitAnimations];
//The Game begins
[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(GameView) userInfo:nil repeats:NO];
}
game.h
Code:
#import "MainMenu.h"
@class MainMenu;
//Pointer to the MainMenu
MainMenu *mainmenu;
@property (nonatomic, retain) IBOutlet MainMenu *mainmenu;
game.m
Code:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
if(mainmenu.NewGame == YES){ //this doesn't get recognized
//The game starts after 8 sec
timer = [NSTimer scheduledTimerWithTimeInterval:8 target:self selector:@selector(StartGame) userInfo:nil repeats:NO];
}
else{
NSlog(@"resume");
}
}