Tag Archives: cocos2d

Links for 2011-7-14 through 2011-7-31

Links for 2011-7-14 through 2011-7-31:

  • Cocos2D Tutorial – Dynamically Coloring Sprites [Brandon Trebitowski, brandontreb.com] Have you ever seen a game (such as Tiny Tower) that contains similar sprites that only vary by certain attributes (coloring, shading, accessories, etc…)? I would often wonder how long it would take the artists to create each permutation of these sprites. After discovering that you can call a method on a CCSprite called setColor, I realized how most of this customization is done in code.
  • Muddying the Budget Waters With Social Security Many people misunderstand how the program operates. Payroll taxes stream into the trust fund that is used to pay current retirees’ benefits. When there is a surplus, that money is invested in a special type of Treasury bond that pays interest to the trust fund. At the end of last year, the trust fund had about $2.6 trillion. And though last year was the first year since 1983 that the fund paid out more than it received in tax revenue, it still continued to grow because of the interest accrued — and it is estimated to continue to grow through 2022.

    Since the money in the trust fund is held in Treasury securities, taxes collected are essentially being lent to the federal government to pay for whatever it wants (and this allows the government to borrow less from the public).

  • The Cult of Centricism We have a crisis in which the right is making insane demands, while the president and Democrats in Congress are bending over backward to be accommodating — offering plans that are all spending cuts and no taxes, plans that are far to the right of public opinion.

    So what do most news reports say? They portray it as a situation in which both sides are equally partisan, equally intransigent — because news reports always do that. And we have influential pundits calling out for a new centrist party, a new centrist president, to get us away from the evils of partisanship.

    The reality, of course, is that we already have a centrist president — actually a moderate conservative president.

  • Revamp of a game [Yuchen Wang, ClingMarks]
  • Cocos2D and ARC [Jerrod Putman, Tiny Tim Games]
  • How To Use Custom Classes With Core Data Without Fear [Doug Sjoquist , Sunetos]
  • User Testing in the Wild: Joe’s First Computer Encounter « Boriss’ Blog
  • Make a backup copy of the MacBook Air USB Software Reinstall Drive | TUAW – The Unofficial Apple Weblog Since it doesn't come with an optical drive, giving MacBook Air buyers a DVD of the operating system wouldn't be very helpful. That's why Apple's lightest laptop comes with the USB Software Reinstall Drive — a very small white USB drive. Sometimes USB flash drives are referred to as "Thumb Drives," but this one is more like the size of a baby's finger.

Posted by Postilicious

Links for 2011-6-6 through 2011-7-13

Links for 2011-6-6 through 2011-7-13:

Posted by Postilicious

Links for 2011-5-10 through 2011-5-14

Links for 2011-5-10 through 2011-5-14:

Posted by Postilicious

Links for May 6th through May 9th

Links for May 6th through May 9th:

Posted by Postilicious

Links for 2011-03-28 through 2011-04-03

Links for 2011-03-28 through 2011-04-03:

Posted by Postilicious

Beware of [self init]

In a new app I’m working on, I created a series of lightweight cocos2d sprite subclasses which simply call the superclass init with some parameters. As soon as I called it I ended up crashing with a weird looking stack trace showing lots of nested calls to init methods.

Screen shot 2011-03-06 at 2.18.44 PM.png

My init methods were pretty simple:


@implementation Gummybear

-(id)init {
    return [super initWithName: @"gummybear.png"];
}

@end

My superclass’s init method used CCSprite’s initWithSpriteFrameName: method.


- (id)initWithName: (NSString*)name
{
    self = [super initWithSpriteFrameName:name];
    if (nil != self) {
		// do some more initialization here
    }
    return self;
}

It ultimately ends up calling initWithTexture:, which is where the problem lies. It turns out initWithTexture: is calling [self init]. Guess which init method was getting called?


-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect
{
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	// IMPORTANT: [self init] and not [super init];
	if( (self = [self init]) )
	{
		[self setTexture:texture];
		[self setTextureRect:rect];
	}
	return self;
}

The fix was to simply change the name of my init method to something else.

Links for 2011-02-22 through 2011-02-26

Links for 2011-02-22 through 2011-02-26:

  • OS X Lion Walkthrough: Versions and Auto Save – Two new features that have found their way in the first Lion developer preview but might seem too complicated or “hidden” as only Apple applications support them right now are Versions and Auto Save. With auto-saving capabilities for documents and a proper versioning system in place, Apple is aiming at simplifying the workflows of many users that have to deal with dozens of documents on a daily basis but often forget to save changes and are inevitably forced to start over. To put it simply, Lion will let you work on your documents without having to worry about saving anything. If you do want to save a specific version of a document, however, you can do so in order to access it later from a Time Machine-esque interface that will let you revert to a previous version of a document at any time. Let’s see how it works.
  • Tiny Wings – Huge Success [Stefan Sorin Nicolin, Spielhaus] – With all these AAA titles coming out for the iOS platform (and elsewhere) there are still some games who pop out of nowhere and climb the charts in no time as if there is nothing easier in the world to accomplish.
  • [devel] OpenGL ES 2.0 support « cocos2d for iPhone – The idea is to use this thread to discuss how to implement OpenGL ES 2.0 support without the need to write a shader for each CCNode.
    The idea is that if the CCNode contains a shader, then it should use it, otherwise it should continue rendering itself using the GL ES 1.0 code.
  • Django Reinhardt: A Look Behind the Namesake of WordPress 3.1 | Blogging, WordPress, Social Media, Web Publishing – WordCast – With the release of WordPress 3.1 and announcement that this version was named Django Reinhardt, WordPress fans around the world are now learning about Django Reinhardt, the legendary and often overlooked jazz guitarist and composer.
  • Cocoa Samurai: Practical Design Patterns with Blocks and Grand Central Dispatch – When Mac OS X 10.6 was introduced, the Mac got a very powerful duo of developer tools that made development on a lot easier. With iOS 4.0 developers finally got access to these tools as well. These tools are known as Blocks & Grand Central Dispatch.
  • Does the world *really* need yet another Twitter client, RSS reader, ToDo list or backup application? « Successful Software – My heart sinks every time I hear a would-be-entrepreneur announcing they have written yet another Twitter client, RSS reader, ToDo list or backup application. Haven’t we got enough of those already? There are more than 1,900 Twitter apps already (possibly a lot more). Somebody probably released another one while I was writing this post. We have passed the Twitter app event horizon, where it is probably quicker to write your own custom app than it is to try and work out if any of the existing apps fulfils your requirements.

Posted by Postilicious