Hey all, brand new to the site, and fairly new to coding.
I am just working on a tower defense game, and atm I am incorporating an RPG element where the player can upgrade their towers in a separate menu.
What I am doing is to pause the game, load the upgrade layer on top of the game screen, then the player can choose their upgrades, after which the layer will disappear and the game will resume.
Where its falling down is removing the layer after the player has chosen their upgrades.
Here is what im doing:
-(void)upgradeSceneLoad
{
ccColor4B c = {255,255,255,0};
upgrademenu = [[[UpgradeLayer alloc]initWithColor:c]autorelease];
[self.parent addChild:upgrademenu z:10];
[[CCDirector sharedDirector] pause];
}
+(void)upgradeSceneRelease
{
[self.parent removeChild:upgrademenu cleanup:TRUE];
[[CCDirector sharedDirector] resume];
}
and in UpgradeScene.m
- (void)healthUpgrade

id)sender
{
[MachineGunTower upgradeHp];
[Tutorial upgradeSceneRelease];
}
------------
Because upgradeSceneRelease is accessed from the UpgradeScene class, i'v had to make it a +(void) rather than a -(void). This change now means that I get an error on this line
[self.parent removeChild:upgrademenu cleanup:TRUE];
saying that the member reference is a pointer and maybe i want to use ->parent instead of .parent. Either way it doesn't work.
So, can anyone see where I am going wrong / other ways of doing this.... it should be very simple right???
Thanks
Aiden