Use SD/HD Particles in Cocos2d

  • administrators

    When using Particle Systems in Cocos2d the particle system automatically scales based on the kind of display being used. If you are using sprites or bitmap fonts you have to provide both SD and HD versions of those assets so that they are rendered at the correct size but the Particle system scales up the image it loads from the plist file automatically.

    For particles this is normally fine as effects are usually quick and it's not noticeable that the texture being used is SD and not HD. To get the particle system to use both an SD/HD texture then you export the particle system as normal, having developed it on the SD stage in PD and also provide in your Cocos project an image file with the -hd extension.

    So if you exported your particle system as fire.plist, the image that it will use is fire.png so you will need to manually provide the HD version of the image and call it fire-hd.png.

    The Cocos particle system first searches for -hd texture files, then non-hd files and then the embedded particle texture. The embedded texture would be the SD version which will get used on non-retina displays and the HD texture will be found in your project, as you supplied it manually, and that will get used on retina displays.

    A key point is that the coordinate system in cocos2d on a retina display uses points not pixels which means the display is still treated as 320x480 on an iPhone. Other engines or peoples own implementations allow use of the pixel coordinates which is why that is available as an option in PD. All stage sizes in PD are represented in pixels and not points.

Log in to reply

Looks like your connection to Forum was lost, please wait while we try to reconnect.