Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-02-2012, 08:27 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 2
aidenfry is on a distinguished road
Question Pause menu help... noobish!

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)healthUpgradeid)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
aidenfry is offline   Reply With Quote
Old 01-02-2012, 09:05 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 2
aidenfry is on a distinguished road
Default Woops

Thanks for anyone who looked into this issue.
I have worked out a way around it (although it still might not be the bst way...)


What i Did was too remove
+(void)upgradeSceneRelease entirely

and change the upgrade function in the upgradeScene class too

- (void)healthUpgradeid)sender
{
[MachineGunTower upgradeHp];
//[Tutorial upgradeSceneRelease];

[self.parent removeChild:self cleanup:TRUE];
[[CCDirector sharedDirector] resume];
}

.... mybad!
Thanks all
aiden
aidenfry is offline   Reply With Quote
Old 01-02-2012, 05:33 PM   #3 (permalink)
Bringing fun to you
 
davidlxk's Avatar
 
Join Date: Dec 2011
Posts: 43
davidlxk is on a distinguished road
Default

also make sure that you call
Code:
[super onExit];
in the layer when you want to pause it and display another layer on it. This ensures that any touches will not happen on that paused layer.

And when you want to unpause it, just use:
Code:
[super onEnter];
davidlxk is offline   Reply With Quote
Reply

Bookmarks

Tags
manager, pause, scene, upgrade

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 385
9 members and 376 guests
apatsufas, comicool, Creativ, dansparrow, husthlj, LunarMoon, mer10, Murphy, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,677
Threads: 94,127
Posts: 402,916
Top Poster: BrianSlick (7,990)
Welcome to our newest member, husthlj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:04 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0