Harder Monsters and More Levels: How To Make A Simple iPhone Game with Cocos2D 2.X Part 3
18 posts
• Page 1 of 2 • 1, 2
Harder Monsters and More Levels: How To Make A Simple iPhone Game with Cocos2D 2.X Part 3
This is the official thread to discuss the following blog post: Harder Monsters and More Levels: How To Make A Simple iPhone Game with Cocos2D 2.X Part 3
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

rwenderlich - Site Admin
- Posts: 1780
- Joined: Thu Dec 23, 2010 4:14 pm
- Has thanked: 26 times
- Been thanked: 187 times
Re: Harder Monsters and More Levels: How To Make A Simple iP
This line of code
- Code: Select all
_levels = [@[level1, level2] retain];
- daithi
- n00b
- Posts: 4
- Joined: Tue Aug 21, 2012 1:53 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
That line uses the new syntax to define an array, so you would need to be on XCode 4.5 to take advantage of it.
As a workaround, you could use
but I would go ahead and upgrade to 4.5.
Have fun!
As a workaround, you could use
- Code: Select all
_levels = [ [NSArray arraywithObjects:level1, level2, nil] retain];
but I would go ahead and upgrade to 4.5.
Have fun!
- rcasey
- Forum Subject Matter Expert
- Posts: 771
- Joined: Fri Jul 01, 2011 6:50 pm
- Has thanked: 0 time
- Been thanked: 132 times
Re: Harder Monsters and More Levels: How To Make A Simple iP
That line uses the new syntax to define an array, so you would need to be on XCode 4.5 to take advantage of it.
As a workaround, you could use
CODE: SELECT ALL
- Code: Select all
_levels = [ [NSArray arraywithObjects:level1, level2, nil] retain];
but I would go ahead and upgrade to 4.5.
Have fun!
Hey thanks rcasey
I was thinking that it was some new 4.5 feature but wasn't 100% sure as I hadn't seen it before. Upgrading is on my todo list.
Thanks again.
- daithi
- n00b
- Posts: 4
- Joined: Tue Aug 21, 2012 1:53 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
Use initWithObjects for 4.2 instead of arrayWithObjects if you are still using 4.2 like me
rcasey was 99% Thanks again
- Code: Select all
_levels = [[[NSArray alloc] initWithObjects:level1, level2, nil] retain];//4.2
- daithi
- n00b
- Posts: 4
- Joined: Tue Aug 21, 2012 1:53 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
Bloody amazing tutorial!
I'm so happy with the timing as well, I was about to do the old tutorial just as it was updated. Yay for me, haha.
Thank you so much, I love this website.
I'm so happy with the timing as well, I was about to do the old tutorial just as it was updated. Yay for me, haha.
Thank you so much, I love this website.
- Infinity-James
- Hacker
- Posts: 43
- Joined: Thu Oct 18, 2012 4:46 pm
- Has thanked: 4 times
- Been thanked: 1 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
I´m still in Xcode 4.3.2 and I have an issue with this line in LevelManager.m
return _levels [_curLevelIdx];
What´s wrong with that?
Thanks!
return _levels [_curLevelIdx];
What´s wrong with that?
Thanks!
- Vicbit
- Baby Hacker
- Posts: 6
- Joined: Mon Dec 10, 2012 7:56 pm
- Has thanked: 1 time
- Been thanked: 0 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
I solved this replacing this line of code
return _levels[_curLevelIdx];
for
return [_levels objectAtIndex: _curLevelIdx];

return _levels[_curLevelIdx];
for
return [_levels objectAtIndex: _curLevelIdx];
- Vicbit
- Baby Hacker
- Posts: 6
- Joined: Mon Dec 10, 2012 7:56 pm
- Has thanked: 1 time
- Been thanked: 0 time
Re: Harder Monsters and More Levels: How To Make A Simple iP
Vicbit wrote:I´m still in Xcode 4.3.2 and I have an issue with this line in LevelManager.m
return _levels [_curLevelIdx];
What´s wrong with that?
Thanks!
That uses the new array syntax.
As a workaround, you can use
- Code: Select all
return [_levels objectAtIndex:_curLevelIdx];
Or you can upgrade to Xcode 4.5
- rcasey
- Forum Subject Matter Expert
- Posts: 771
- Joined: Fri Jul 01, 2011 6:50 pm
- Has thanked: 0 time
- Been thanked: 132 times
Re: Harder Monsters and More Levels: How To Make A Simple iP
Hi,
Thanks for this amazing tutorial, so good job !
Somewhere at the beginning, you talked about component based architecture for games development.
Is there any of your cocos2d tutorials based on this kind of architecture at this moment ? I would love to know how it works.
Thanks again !
Thanks for this amazing tutorial, so good job !
Somewhere at the beginning, you talked about component based architecture for games development.
Is there any of your cocos2d tutorials based on this kind of architecture at this moment ? I would love to know how it works.
Thanks again !
- Yaman
- n00b
- Posts: 1
- Joined: Sun Dec 23, 2012 1:09 am
- Has thanked: 0 time
- Been thanked: 0 time
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 6 guests