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 03-27-2011, 10:55 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 24
jackosx is on a distinguished road
Default Sending a message to a class

I have a subclass of CCNode, and I want to have several instances of it, so my layer would send a message to it telling it which sprite to use. in my layer with the game I am using
Code:
		CCSprite *babybird = [CCSprite spriteWithFile:@"BabyBird.png"];
		BirdNode *bird1 = [BirdNode alloc];
		[self addChild:bird1];
		[bird1 setupWithBirdType:babybird];
and in my subclass of CCNode I have the method
Code:
-(void)setupWithBirdType:(CCNode *)type
{			NSLog(@"working");
	[self  addChild:type];
}
The setupWithBirdType method isn't being called, can anybody explain to me why?
jackosx is offline   Reply With Quote
Old 03-27-2011, 04:25 PM   #2 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

You didin't init the BirdNode,, try that first.

Code:
BirdNode *bird1 = [[BirdNode alloc]init];

or 

BirdNode *bird1 = [BirdNode node];
__________________

Free Games!
smasher is offline   Reply With Quote
Reply

Bookmarks

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: 426
7 members and 419 guests
chemistry, Emy, hussain1982, mistergreen2011, Retouchable, skrew88, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,922
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

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