Making it rain in Cocos2d

Read this tutorial to learn how to make it rain using particles in cocos2d.

We begin by adding the rain drop image to our project.

All you have to do is add the code bellow to your init meathod.

[super onEnter];

CCParticleSystem* emitter = [CCParticleRain node];

[self addChild: emitter z:10];

CGPoint p = emitter.position;

emitter.position = ccp( p.x, p.y);

emitter.life = 4;

emitter.texture = [[CCTextureCache sharedTextureCache] addImage: @"Raindrop.png"];

emitter.startSize = 10.0f;

Life is how long the particles in the emitter last. Texture is the image you want the particles to be. StartSize is the size of the particles to begin with. If you would like to see more of what you can do with particles run the particle test that comes with cocos2d.

Download the code for making it rain in cocos2d

Copy right Britney Lee Johnson August 2010.

This entry was posted in cocos2d. Bookmark the permalink.

7 Responses to Making it rain in Cocos2d

  1. I just like the helpful information you provide for your articles.
    I will bookmark your weblog and test again right here
    frequently. I am relatively certain I’ll learn many new stuff proper
    right here! Good luck for the next!

  2. Google says:

    This is because this device assures to either benefit or cure
    the autistic people in more ways than one. 20 percent of customers have the potential
    to spend five times as much as they do currently
    A relatively small amount of marketing effort creates the majority of
    output. But it seems Memorial Day wasn’t important enough to Google.

  3. Kristopher says:

    I’m really enjoying the design and layout of your site.

    It’s a very easy on the eyes which maqkes it much more enjoyable for me to come here and visit more often. Did you hire
    out a developer to create your theme? Outstanding work!

  4. Hi it’s me, I am also visiting this site on a regular basis, this website is truly pleasant and the visitors are really sharing nice thoughts.

  5. landscaper says:

    Helpful info. Lucky me I discovered your site by accident, and I
    am stunned why this accident did not came about earlier!
    I bookmarked it.

    my blog – landscaper

  6. Why don’t we take a good look at exactly how we for instance can transform the eggs
    and milk towards cake of. You can substitute eggs
    with vegan pleasant items for instance agar dust, potato starch, vinegar, flax seeds or agario hack even mashed potatoes.

  7. Clash Royale has a pretty excellent match-making system, and the greater arena you remain in, the better the reward.
    So do not drop prizes simply to combat in a lower arena as the reward isn’t really as huge.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>