<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: particles - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/particles</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 04:16:43 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/particles/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>criistii on "Particle scaling iPad vs iPhone"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/11059#post-62897</link>
			<pubDate>Fri, 12 Nov 2010 09:13:00 +0000</pubDate>
			<dc:creator>criistii</dc:creator>
			<guid isPermaLink="false">62897@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi.</p>
<p>The last version of cocos2d introduced the concept of points (as opposed to pixels). This resulted in an inconsistency when developing a game for both iPad and iPhone, particles are to big and to fast on the iPhone if I design the particles for the iPad.</p>
<p>Because of this I wrote a small utility method, and would love some feedback on this issue, or tips for a better approach:<br />
<pre><code>+ (void) adjustParticlesForDevice:(CCParticleSystemQuad*)p {
	CGFloat scale = IsIPad ? 1.0 : .5;

	p.startSize = p.startSize * scale;
	p.startSizeVar = p.startSizeVar * scale;
	p.endSize = p.endSize * scale;
	p.endSizeVar = p.endSizeVar * scale;
	p.speed = p.speed * scale;
	p.speedVar = p.speedVar * scale;
	p.gravity = ccp(p.gravity.x * scale, p.gravity.y * scale);
}</code></pre>
<p>UPDATE:<br />
After a bit more testing I noticed I need to update the life span as well, I find this very strange...<br />
<pre><code>p.life = p.life * scale;
	p.lifeVar = p.lifeVar * scale;</code></pre></description>
		</item>
		<item>
			<title>aramk on "Draw CCParticleSystem on CCRenderTexture"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28707#post-141488</link>
			<pubDate>Fri, 27 Jan 2012 06:48:58 +0000</pubDate>
			<dc:creator>aramk</dc:creator>
			<guid isPermaLink="false">141488@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How would one go about adding a CCRenderTexture into a CCParticleSystem and draw the CCParticleSystem into the CCRenderTexture, then draw this texture instead of the CCParticleSystem. This will allow a blend function to be used between the CCParticleSystem and the CCRenderTexture. The reason being this:</p>
<p><a href="http://gamedev.stackexchange.com/questions/22989/how-can-i-achieve-a-good-fire-effect-with-alpha-blending-and-particles/22990#22990" rel="nofollow">http://gamedev.stackexchange.com/questions/22989/how-can-i-achieve-a-good-fire-effect-with-alpha-blending-and-particles/22990#22990</a></p>
<p>Here's what I have in the draw: of CCParticleSystem:</p>
<pre>
<code>
-(void) draw {
	CCRenderTexture *rte = [CCRenderTexture renderTextureWithWidth:200 height:300];
	[rte beginWithClear:0 g:0 b:0 a:0.5];
	[super draw];
	[rte end];
	[rte visit];
}
</code>
</pre>
<p>Whatever I'm doing is slightly wrong, because the CCParticleSystem texture drawn onto the CCRenderTexture is moving across the CCParticleSystem as the CCParticleSystem moves around. This is probably something to do with draw and how it works with positions. Is there a way to still do all this inside the CCParticleSystem (so I can still keep it all in one object), or do I have to make a second class to store both the CCRenderTexture and also the CCParticleSystem?
</p></description>
		</item>
		<item>
			<title>jellyfish on "How do I get a sprite to leave &quot;prints&quot; of itself that fade out."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28002#post-137567</link>
			<pubDate>Mon, 02 Jan 2012 08:25:58 +0000</pubDate>
			<dc:creator>jellyfish</dc:creator>
			<guid isPermaLink="false">137567@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>When you are loading a YouTube video, there is a little dot, moving in a circle, that has four dots, following it, each progressively darker, almost like footprints that fade out.  I want to find different ways of doing this, to find the one that best suits my purpose.  I do not want a single rotating image, with the dots already drawn on it, because I want the option of moving the dot in different ways and directions (e.g.  following a path).  I have experimented with particles and gotten lots of flashy effects, but could not reduce it to just four "prints" that fade out.<br />
Here is the dot going in a circle:</p>
<p>		`CCSprite *myBox = [CCSprite node];<br />
        [myBox setTextureRect:CGRectMake(0, 20, 8, 8)];<br />
        [myBox setPosition:ccp(160, 340)];<br />
        [myBox setAnchorPoint:ccp(.5,10)];</p>
<p>        [myBox setColor:ccGREEN];<br />
        [self addChild:myBox];</p>
<p>        id rotate1 = [CCRotateBy actionWithDuration:0 angle:15];<br />
        id delay = [CCDelayTime actionWithDuration:.1];</p>
<p>        [myBox runAction:[CCRepeatForever actionWithAction:[CCSequence actions:rotate1, delay, nil]]];`</p>
<p>Thanks.
</p></description>
		</item>
		<item>
			<title>beleg on "Amazing breaker style buttons effects"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28422#post-139886</link>
			<pubDate>Tue, 17 Jan 2012 17:15:58 +0000</pubDate>
			<dc:creator>beleg</dc:creator>
			<guid isPermaLink="false">139886@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Anyone have any suggestions for getting CoCos2d to do the button effects on the free amazing breaker game? I really like how when you hit the play button the particles flash across the screen but I am not exactly sure how to implement the effect. Thanks
</p></description>
		</item>
		<item>
			<title>kastrum on "Particle Alchemist is now &quot;Available in the App Store&quot;"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28395#post-139781</link>
			<pubDate>Tue, 17 Jan 2012 03:10:06 +0000</pubDate>
			<dc:creator>kastrum</dc:creator>
			<guid isPermaLink="false">139781@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Everyone!</p>
<p>I am really excited to announce the release of <a href="https://www.valorapps.com/mobile-apps-pages/particle-alchemist.html">Particle Alchemist</a>! It's a particle system prototyping utility that persons can use to simulate and test particle system settings for their apps. You can save plists and access them in the iTunes File Sharing or send them to your email. You have 30 built-in particle system templates to start you off with. In addition, you can also open up existing plist files that you made from Particle Designer and change them to your liking, then create a new tweaked plist file. it is for the iPad only, though. </p>
<p>It is FREE to use! Please try it out and review it. Thanks!</p>
<p>Check it out at the <a href="http://itunes.apple.com/us/app/particle-alchemist/id482122509?ls=1&#38;mt=8">App Store Link</a>
</p></description>
		</item>
		<item>
			<title>col55 on "Particle effect problem. fine in sim,device but not distribution copy"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28162#post-138527</link>
			<pubDate>Sat, 07 Jan 2012 15:57:19 +0000</pubDate>
			<dc:creator>col55</dc:creator>
			<guid isPermaLink="false">138527@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi guys i wonder if anybody can share some light on the particle problem i have.<br />
heres how i load them.</p>
<p>CCParticleSystem* system4;<br />
system4 = [ARCH_OPTIMAL_PARTICLE_SYSTEM particleWithFile:@"jetstream.plist"];<br />
system4.autoRemoveOnFinish = YES;<br />
system4.position = ccp(0,14);<br />
[self addChild:system4];</p>
<p>now in my resources i have all the files jet stream.plist and .png for the particles. the png is named in the plist so no problem there.</p>
<p>whats happening is the particles work fine in simulator and device while in debug mode.<br />
but the distribution copy that people down load from iTunes they only work in certain scenes so its really strange.<br />
what gets even stranger is the first scene a particle gets called it works fine but then i call another scene with that same particle affect and it does not load but all the time it loads fine in debug mode in sim and device.</p>
<p>can anybody help.</p>
<p>p.s the particle effect in question is part of a spaceship class. an instance of this class gets created for different scenes</p>
<p>thanks in advance colyn</p>
<p>check out the game in question Cave Shooter 2
</p></description>
		</item>
		<item>
			<title>adpro on "Optimize ParticleSystems"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/177#post-910</link>
			<pubDate>Thu, 18 Jun 2009 19:31:40 +0000</pubDate>
			<dc:creator>adpro</dc:creator>
			<guid isPermaLink="false">910@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,</p>
<p>As some of you know, I was asking questions about some other stuff earlier and it led me to the suggestion of pre-allocating particles for my ParticleExplosion I am using for my game.</p>
<p>Basically, I am using a bunch of particle explosions when sprites interact.  Think of space invaders, but with different types of bullets that interact differently with different enemies.  A lot of the time, there will be explosions when two sprites interact.  Many explosions can be going on at the same time - in fact, there are usually at least 2 explosions going on at the exact same time.</p>
<p>I figured I would start a thread to help me, and others in search of the same answers, find answers to optimizing particle systems for their games.</p>
<p>After a bunch of explosions happen in my game (there has to be a lot), it slows down to about 30-40fps.  It doesn't start slowing down until after about 150-200+ explosions.</p>
<p>It was suggested to pre-allocate the particles.  I have gone into particle.m and other files, but haven't been able to figure out how to do this exactly.  I'm also new to chipmunk, cocos2d, cocoa and objective-c, so maybe I am missing something simple.  I searched google to see if there was anything, but I couldn't find anything.</p>
<p>I'm thinking these answers would help a lot of people, so any information would be greatly appreciated.  I'll post what I find as well in here.</p>
<p>Thanks all!
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?]CCParticleSystemQuad Source Rotation Manipulation."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27824#post-136700</link>
			<pubDate>Fri, 23 Dec 2011 13:54:21 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">136700@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a sprite 16 x 16 representing a vehicle.<br />
Obviously this square has 4 sides (Front, Left, Right, Back).</p>
<p>I want particles to trail only from the back.<br />
The 'car' only moves in 90 Degree rotations - the car can only move either fully left, right, forwards, or backwards. (top down view).<br />
------------------------------------------------<br />
Particles must be free (kCCPositionTypeFree and kCCPositionTypeRelative).<br />
The direction/rotation of the particle emitter must be dependent on which way the car is facing. </p>
<p>The properties of the emitter that need to be modified are:<br />
Gravity (x)<br />
Gravity (y)<br />
SourcePos (y) + Variance<br />
SourcePos (x)  + Variance </p>
<p>For example if the car is facing to the right (and moving) the values would be:<br />
Gravity x = 900 (EDIT: -900)<br />
Gravity y = 0<br />
(EDIT)<br />
SourcePos y = Car's position.y  VARIANCE: = 26<br />
SourcePos x = Car's position.x - 8 (1/2 of 16)</p>
<p>------------------------------------------------------<br />
The problem?<br />
I would love to be able to just attach the emitter as a child to the car and all the transformation to it would match that - but from the searches and experimentation I've done I realize that is not possible because of the the emitters relativity to the parent node. </p>
<p>Instead of just using a switch statement in my update loop and setting all the different properties for each type of rotation/direction, is there a more elegant way to accomplish this in code?
</p></description>
		</item>
		<item>
			<title>machineboy on "CCFollow and particles as kPositionTypeFree problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/15740#post-89043</link>
			<pubDate>Tue, 19 Apr 2011 20:55:54 +0000</pubDate>
			<dc:creator>machineboy</dc:creator>
			<guid isPermaLink="false">89043@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, I'm working on a new game mode for my game Flap Flap, and have encountered a problem with a particle emitter that follows a sprite. The goal is to create a trail of particles behind the sprite, and when updating the position of the particle with the position of the sprite, this works fine when particle.positionType = kPositionTypeFree;</p>
<p>However, when using the CCFollow action on the sprite, the trail "flattens" out as soon as the world scrolls. It's hard to describe, but there seems to be a problem with the particles not flowing properly when CCFollow adjusts the sprite position to center it.  It's difficult to explain what goes wrong, but I imagine there being some conflict of offset position values when CCFollow is working its magic to keep the sprite in the center of the screen.</p>
<p>Has anyone worked with CCFollow and moving particles or have any ideas how to fix this?
</p></description>
		</item>
		<item>
			<title>Chronocore on "[GAME] GeoDrop HD (December 20th 2011)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27750#post-136360</link>
			<pubDate>Tue, 20 Dec 2011 22:45:29 +0000</pubDate>
			<dc:creator>Chronocore</dc:creator>
			<guid isPermaLink="false">136360@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Release: December 20th 2011<br />
Devices: iPhone, iPad, iPod touch<br />
Developer: Stefan Kögler<br />
Music produced by: Chris Huelsbeck<br />
Price: $0.99</p>
<p>The new iOS puzzle game in the abstract particles look with 3 brand new music tracks from Chris Huelsbeck is now available! </p>
<p>Tired of always the same match-3 puzzle games? Here is the new challenge: Create clusters of blocks with the same color. 2 stars inside the cluster removes the cluster. Special blocks like bombs or joker helps you to accomplish this mission. To make the game harder: After some blocks a new row of blocks appear from the bottom of the playfield.</p>
<p>3 GAME MODES:<br />
Classic: More and more colors, bombs and joker blocks - the full program!<br />
Hardcore: The purist mode for the Constructors' experts: Constant 4 colors - No special stones. But level rise is faster.<br />
Action: Same as hardcore, but with 3 minutes time limit: For the little break in between.</p>
<p>HIGHLIGHTS:<br />
- Game Center Achievements: Get all 1000 points!<br />
- Game Center Leaderboard for each game mode.<br />
- 3 Exclusive music tracks produced by Chris Huelsbeck<br />
- Universal app for iPhone, iPod touch and iPad<br />
- Full HD / Retina graphics support</p>
<p>SCREENSHOTS:<br />
<a href="http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_1.png" rel="nofollow">http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_1.png</a><br />
<a href="http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_2.png" rel="nofollow">http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_2.png</a><br />
<a href="http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_3.png" rel="nofollow">http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_3.png</a><br />
<a href="http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_4.png" rel="nofollow">http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_4.png</a><br />
<a href="http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_5.png" rel="nofollow">http://www.cocos2d-iphone.org/games/scraper/images/478344246/screenshot_5.png</a>
</p></description>
		</item>
		<item>
			<title>indy2005 on "[LevelSVG] Placing physics objects at tilemap positions"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/14339#post-81174</link>
			<pubDate>Wed, 09 Mar 2011 23:00:18 +0000</pubDate>
			<dc:creator>indy2005</dc:creator>
			<guid isPermaLink="false">81174@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I am using LevelSVG and have followed the instructions of taking a png of the TMX tilemap and placing it at 0,0 in InkScape, so I can trace the physics world around it.</p>
<p>This is working great, but what I would like to do is detect whether certain types of collisions are happening in certain tiles with specific properties.  For example, if a collision with a bullet happens in a tile with a property of "isStalectite" I can place some particle effects and some crumbling physics bodies at that tile location.</p>
<p>Also, I would like to parse the tilemap for tiles with a property set, such as "isRockSpawner" and then periodically create physics objects at that position.  But I am not sure how to swap between tile positions and physics co-ordinates.</p>
<p>I am also not sure how the instructions to position a bitmap in LevelSVG at (0,0) in Inkscape works...unless TMX tilemaps are created with an anchor at the bottom left (0,0), rather than in the centre...</p>
<p>Any advice appreciated.</p>
<p>Regards</p>
<p>i
</p></description>
		</item>
		<item>
			<title>pyrosphere on "Code for a custom node with lots of tiny points"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/12108#post-68200</link>
			<pubDate>Fri, 24 Dec 2010 16:27:48 +0000</pubDate>
			<dc:creator>pyrosphere</dc:creator>
			<guid isPermaLink="false">68200@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,</p>
<p>I released my second game (first one using cocos2d) so I decided to give back a bit to the community and share some code I made to solve a very specific problem. This might help someone out there with a similar situation but I find it interesting enough as a case study.</p>
<p>The game is Last Fish (more in <a href="http://www.cocos2d-iphone.org/forum/topic/12107" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/12107</a> ) and uses a minimalist black and white style. To provide the underwater mood I wanted to add lots of tiny white points that would appear, move slowly in a random direction and disappear. Here's a screenshot of the final result (you can see this behavior animated in the trailer):</p>
<p><img src="http://pyrosphere.net/lastfish/press/last_fish_points.png" alt="Last Fish (ambient tiny points only)" /></p>
<p><img src="http://pyrosphere.net/lastfish/press/s1.jpg" alt="Last Fish screenshot" /></p>
<p>To do this I initially considered using a cocos2d particle system, however I couldn't get it to both fade in and fade out. Also I only wanted very small ambient points, and felt that it would be overkill to use individual sprites for each point. So I decided to use OpenGL points.</p>
<p>I created a custom node to override <code>draw</code> and have the points as <code>GL_POINTS</code>.</p>
<p>The node would store three arrays: one with positions, one with speeds, one of colors.</p>
<p>The color array is all white, but starts at opacity 0, goes up to the max opacity, then comes back to 0. It remains unchanged. </p>
<p>At each update the speed is applied to the positions. The place where the position/color array match is also changed on each update to give the illusion that the points are fading in then fading out. Also, at each update, the couple of points with opacity 0 (after fading out) get a new random position and speed to create a new point.</p>
<p>This way allows a minimal number of processing to update points and only needs two sets of calls to <code>glColorPointer()</code>, <code>glVertexPointer()</code>, <code>glDrawArrays()</code> to draw all points. </p>
<p>The method <code>updateWithDelay:</code> can be called manually or on its own scheduler.</p>
<p>I'd like to point out that the following code works only in 480x320 (haven't updated it yet for Retina Display). Please reply about any bug, optimization suggestion, or questions. Thanks.</p>
<p>PointsNode.h</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@class GameScene;

@interface PointsNode : CCNode {
    float colorStart;
    float *colors;
    float *points;
    float *speed;
}

-(void)updateWithDelay:(ccTime)dt;

@end</code></pre>
<p>PointsNode.m</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;PointsNode.h&#34;

#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> ARC4RANDOM_MAX 0x100000000LL
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> RANDI(min,max) ((arc4random()%(max-min))+min)
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> RANDF(min,max) (((double)arc4random() / ARC4RANDOM_MAX) * (max-min) + min)

#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> POINTS_NUMBER    100
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> POINTS_MAX_ALPHA 0.25f
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> POINTS_LIFE      10.0f
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> POINTS_MAX_SPEED 10.0f

@implementation PointsNode

-(id)init {
    if ((self == [super init])) {

        colorStart = 0;

        colors = (float*)malloc(POINTS_NUMBER * 4 * sizeof(float));
        int i = 0;
        int t = POINTS_NUMBER * 2;
        float c = 0.0f;
        float dc = 2.0f * POINTS_MAX_ALPHA / (float)POINTS_NUMBER;
        while(i &#60; t) {
            colors[i++]=1.0f;
            colors[i++]=1.0f;
            colors[i++]=1.0f;
            colors[i++]=c;
            c+=dc;
        }
        t = POINTS_NUMBER * 4;
        while(i &#60; t) {
            colors[i++]=1.0f;
            colors[i++]=1.0f;
            colors[i++]=1.0f;
            colors[i++]=c;
            c-=dc;
        }

        points = (float*)malloc(POINTS_NUMBER * 2 * sizeof(float));
        i=0;
        t = POINTS_NUMBER * 2;
        while (i &#60; t) {
            points[i++] = RANDF(0.0f, 480.0f);
            points[i++] = RANDF(0.0f, 320.0f);
        }

        speed = (float*)malloc(POINTS_NUMBER * 2 * sizeof(float));
        i=0;
        t = POINTS_NUMBER * 2;
        while (i &#60; t) {
            speed[i++] = RANDF(-1.0f*POINTS_MAX_SPEED, 1.0f*POINTS_MAX_SPEED);
            speed[i++] = RANDF(-1.0f*POINTS_MAX_SPEED, 1.0f*POINTS_MAX_SPEED);
        }

    }
    return self;
}

-(void)dealloc {

    free(colors), colors=0;
    free(points), points=0;
    free(speed), speed=0;

    [super dealloc];
}

-(void)draw {

    glPointSize(2.0f);

    glDisable(GL_TEXTURE_2D);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);

    glEnable(GL_POINT_SMOOTH);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    int cs = (int)colorStart;
    int ncs = POINTS_NUMBER-cs;

    glColorPointer(4, GL_FLOAT, 0, colors);
    glVertexPointer(2, GL_FLOAT, 0, points + cs * 2);
    glDrawArrays(GL_POINTS, 0, ncs);

    glColorPointer(4, GL_FLOAT, 0, colors + ncs * 4);
    glVertexPointer(2, GL_FLOAT, 0, points);
    glDrawArrays(GL_POINTS, 0, cs);

    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnable(GL_TEXTURE_2D);    

}

-(void)updateWithDelay:(ccTime)dt {

    int c1 = (int)colorStart;
    colorStart += (dt * POINTS_NUMBER) / POINTS_LIFE;
    int c2 = MIN((int)colorStart, POINTS_NUMBER);

    if (colorStart &#62;= POINTS_NUMBER) {
        colorStart = 0.0f;
    }

    int i = 0;
    int t = POINTS_NUMBER * 2;
    while (i &#60; t) {
        points[i] += speed[i] * dt;
        i++;
    }

    if (c1 == c2) {
        return;
    }

    //update points between c1 and c2
    for (i=c1; i&#60;c2; i++) {
        points[i*2] = RANDF(0.0f, 480.0f);
        points[i*2+1] = RANDF(0.0f, 320.0f);
        speed[i*2] = RANDF(-1.0f*POINTS_MAX_SPEED, 1.0f*POINTS_MAX_SPEED);
        speed[i*2+1] = RANDF(-1.0f*POINTS_MAX_SPEED, 1.0f*POINTS_MAX_SPEED);
    }

}

@end</code></pre></description>
		</item>
		<item>
			<title>GoldenJoe on "Slowing down particles?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24678#post-130077</link>
			<pubDate>Tue, 29 Nov 2011 06:46:03 +0000</pubDate>
			<dc:creator>GoldenJoe</dc:creator>
			<guid isPermaLink="false">130077@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I see that CCParticleSystem has a speed property, but setting it doesn't have the expected effect. For example, if I set it to 0.5f, I would expect particles to spawn half as frequently and last twice as long. Can anyone recommend steps to achieve this effect? Thanks.
</p></description>
		</item>
		<item>
			<title>Matz0r on "Pixelated Particles"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22438#post-124519</link>
			<pubDate>Fri, 04 Nov 2011 16:54:07 +0000</pubDate>
			<dc:creator>Matz0r</dc:creator>
			<guid isPermaLink="false">124519@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys, I dont know if this is a bug or what, but im getting ugly pixelated particles in my projects (tested devine/simulator)</p>
<p>Ive tried starting a new project but I end with the same results.
</p></description>
		</item>
		<item>
			<title>bummzack on "[solved] Is it possible to create a Particle-System using sprite-batch?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22312#post-123778</link>
			<pubDate>Mon, 31 Oct 2011 10:43:50 +0000</pubDate>
			<dc:creator>bummzack</dc:creator>
			<guid isPermaLink="false">123778@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a game level and entities that are entirely created and drawn within a CCSpriteBatchNode. Now I wanted to add particles (I'm loading the particle-system from a .plist) to my game and encountered the following issues:</p>
<ol>
<li>I cannot create a particle system with a .plist <strong>without</strong> having the texture as a separate file. Although I never need that file, as I want to use the texture-data from my atlas</li>
<li>It seems like it's not possible to add the particle-system to a CCSpriteBatchNode</li>
</ol>
<p>I was wondering if somebody has figured out a way to include particles in a batch-node system? Theoretically it shouldn't be that hard, since the particles could benefit from the same batch-calls?</p>
<p>Any pointers on this would be greatly appreciated.
</p></description>
		</item>
		<item>
			<title>summoner on "Emit Particles along line/curve"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22107#post-122868</link>
			<pubDate>Tue, 25 Oct 2011 02:09:05 +0000</pubDate>
			<dc:creator>summoner</dc:creator>
			<guid isPermaLink="false">122868@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Just wondering whether there is a way to emit particles along line/curve. From the example CCParticleSnow in CCParticleExamples.m, we could only set the emitter position and the variation.</p>
<p>Otherwise, we could only emit particles on all control points. Thanks.
</p></description>
		</item>
		<item>
			<title>demetriusb on "Particle Designer"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8234#post-47890</link>
			<pubDate>Mon, 26 Jul 2010 19:19:44 +0000</pubDate>
			<dc:creator>demetriusb</dc:creator>
			<guid isPermaLink="false">47890@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm trying to use particle designer, but have run into problems.</p>
<p>In my h. file, I've put this:</p>
<pre><code>CCQuadParticleSystem *emitter;</code></pre>
<p>In my m. file, I used:</p>
<pre><code>CCQuadParticleSystem *particle = [CCQuadParticleSystem particleWithFile:@&#34;test.plist&#34;];
	[aboutLayer addChild:particle];</code></pre>
<p>I get this message: </p>
<pre><code>warning: &#39;CCQuadParticleSystem&#39; may not respond to &#39;+particleWithFile:&#39;</code></pre>
<p>And when I try to run the app it crashes.</p>
<p>Any suggestions is greatly appreciated.</p>
<p>DemetriusB
</p></description>
		</item>
		<item>
			<title>dhmspector on "Particle Designer with Embedded Texture: Can&#039;t create Texture. UIImage is nil"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17863#post-100270</link>
			<pubDate>Tue, 21 Jun 2011 22:48:53 +0000</pubDate>
			<dc:creator>dhmspector</dc:creator>
			<guid isPermaLink="false">100270@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm working on a project using 71^2's Particle Designer but am running into a problem - I cannot seem to get the texture part of the emitter to load if the PList is set up embed the Emitter's texture  The code is about as straight-forward as it gets:</p>
<p>        `NSString *particleFilePath = @"blackhole.plist";<br />
        CCParticleSystemQuad    *_emitter = [CCParticleSystemQuad particleWithFile:particleFilePath];<br />
        `<br />
The emitter loads from the plist (i.e., all of its main values are loaded), but it can't seem to get the texture out of the plist, I see the following in the console log:</p>
<p>2011-06-21 14:10:52.887 ParticleTester[45053:207] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil<br />
2011-06-21 14:10:52.888 ParticleTester[45053:207] cocos2d: Couldn't add image:particleTexture.png in CCTextureCache</p>
<p>However, if I tell Particle Designer NOT to embed the texture, the emitter works -- with one catch:  both the plist and the texture file have to be at the root of the app's bundle.  If I try to put them in folders (for example, like resources as part of a level of a game that I might sell via IAP) the PList part loads, but the cocos2d particle system loader crashes because it can't find the texture file.. </p>
<p>Anyone else seen this?   this is using Cocos2d-iPhone-1.0.0-rc3
</p></description>
		</item>
		<item>
			<title>par02 on "How to send particles to a specific location"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21445#post-119212</link>
			<pubDate>Sun, 02 Oct 2011 06:30:32 +0000</pubDate>
			<dc:creator>par02</dc:creator>
			<guid isPermaLink="false">119212@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have been using particle system in Cocos2d along w/ Particle Designer quite extensively up until now and I haven't had any issues that I couldnt figure out..</p>
<p>What I am attempting to do is to launch a particle system from a specific location and have the particles end up at a specific destination.  Is this possible?</p>
<p>The only thing I have been able to do is figure out the angle from the source to the destination and muck w/ the life and speed of the particles to "try" and get them to go where I want.</p>
<p>If there is an easier way to do this I would be very grateful!</p>
<p>Thanks!</p>
<p>PAR
</p></description>
		</item>
		<item>
			<title>ashmira on "particles runActions and setOpacity"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21278#post-118338</link>
			<pubDate>Tue, 27 Sep 2011 08:47:02 +0000</pubDate>
			<dc:creator>ashmira</dc:creator>
			<guid isPermaLink="false">118338@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>how to make particles fadeout? i try to make the particles to fadeout in 0.5 sec. i try it and it got error. is there any alternative to make this fadeout actions for particles?<br />
<pre><code>- (void) addPoisonEffects{
	poisonEffects = [ARCH_OPTIMAL_PARTICLE_SYSTEM particleWithFile:@&#34;PoisonEffects.plist&#34;];
	[poisonEffects setPosition:ccp(240,160)];
	[self addChild:poisonEffects z:100];

}
- (void) removePoisonEffects{
	if (poisonEffects!=nil) {
		[poisonEffects runAction:[CCFadeOut actionWithDuration:0.5f]];
	}
}</code></pre></description>
		</item>
		<item>
			<title>Gillies on "Particle Scaling Changed in 1.0.1?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20869#post-115981</link>
			<pubDate>Wed, 14 Sep 2011 19:39:02 +0000</pubDate>
			<dc:creator>Gillies</dc:creator>
			<guid isPermaLink="false">115981@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi there</p>
<p>I upgraded from 1.0 Beta to 1.0.1 yesterday, and I am sure that it has had an impact on my particle effects.<br />
The effects themselves seem to be scaled correctly, but the particles do not.<br />
This results in overly dense looking effects on the iPhone, where the distribution is correctly scaled, but with big particles.</p>
<p>Has anyone else seen this issue?<br />
I cannot find differences in the particle code itself that could have lead to this.</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>doncic on "moving particles are causing game to lag"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/20590#post-114397</link>
			<pubDate>Mon, 05 Sep 2011 12:57:56 +0000</pubDate>
			<dc:creator>doncic</dc:creator>
			<guid isPermaLink="false">114397@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have issues with particle effects that are moving around.<br />
I use particle designer to create my particle effects with the image embedded.<br />
As long as the particle stands still there is no problem, but when i move it around it starts to lag.<br />
It also kind of looks like the individual particles are torn between the (relative) position where they were created and the current position of the particle emitter source.<br />
It's the same on the particle designer preview.<br />
Is this because of the way the cocos2d particle system is implemented or am i missing something?
</p></description>
		</item>
		<item>
			<title>kemnet on "Help on using One world"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/19161#post-107376</link>
			<pubDate>Wed, 27 Jul 2011 16:08:06 +0000</pubDate>
			<dc:creator>kemnet</dc:creator>
			<guid isPermaLink="false">107376@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello community,<br />
i have a file named MScene where i named created my physics world and my walls and everything.<br />
so i created this stage.mm file where im adding my tiles which contain objects, but to make it work i find myself having to initialize and create ANOTHER world which cause my sprite( i added b4) and the sprite i also added in stage.mm to react different to the enviroment. This make sense does it?cause they exist in different worlds? id liike to use the world from MScene.mm anyone can tell me how to pull it in? i hav a simpleton in MScene inalized as</p>
<pre><code>static GameMScene* GameSceneInstance;

+(GameMScene*) gameTable
{
	NSAssert(GameSceneInstance !=nil,@&#34;Table not yet initalized&#34;);
	return GameSceneInstance;
}</code></pre></description>
		</item>
		<item>
			<title>Duckwit on "[Solved] Creating my own &#039;particles&#039;"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18910#post-106009</link>
			<pubDate>Wed, 20 Jul 2011 12:38:47 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">106009@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am trying to create a particle effect like the following (NOTE: This does not in any way involve Particle Design or any other 'particle engine' tools and classes) -</p>
<p>Wherever the player (_character) moves, every 1/2th of a second (0.5f Seconds) a 'particle' (32 x 12 texture) will be loaded onto the player's position and start shrinking and fading, when the scale is below a certain value, the particle should be removed from the layer and the array it is stored in. </p>
<p>Right now I  have a system that goes somewhat like this -<br />
Method declaration -<br />
<pre><code>//In HelloWorldScene.h
-(void)launchParticle:(float)delta;

//In HelloWorldScene.m (Init method)
[self schedule:@selector(launchParticle:)];</code></pre>
<p>This is the method itself - (Creates and releases particles, has been scheduled but can also just be called from other scheduled method)<br />
<pre><code>-(void)launchParticle:(float)delta {
	if (isRunning) {
		CCSprite* particle = [CCSprite spriteWithFile:@&#34;Crate.png&#34;];
		particle.position = ccp(_character.position.x , _character.position.y);
		if ([_particles count] &#60;= 3) {
			printf(&#34;Add Particle \n&#34;);
			[_gameLayer addChild:particle z:10];
			[_particles addObject:particle]; } }

	for (int i = 0; i &#60; [_particles count]; i++) {
		CCSprite* fadeParticle = [_particles objectAtIndex:i];
		printf(&#34;Check Scale\n &#34;);
		if (fadeParticle.scale &#62; 0.2) {
			printf(&#34;Shrink\n &#34;);
			fadeParticle.scale -= 0.01; }
		else {
			[_gameLayer removeChild:fadeParticle cleanup:YES];
			[_particles removeObjectAtIndex:i]; }}}</code></pre>
<p>This is how it works so far -<br />
When the character starts moving 'isRunning' is turned on and starts the particle cycle, immediately (well, within 5/60ths of a second) 5 particles are created, all start fading, then get recreated all together again. </p>
<p>My only problem is there needs to  be a gap between the addition of these particles to the _gameLayer and the _particles array. </p>
<p>This is a bit of a long drawn out problem - but it would be greatly appreciated having any advice on a way I could space out the creation of these particles. </p>
<p>Thanks :D</p>
<p>Tom Bellingham</p>
<p>EDIT: Sorry, 4  particles, not 5.
</p></description>
		</item>
		<item>
			<title>ThePacMan on "No Opacity Setting for Particles?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18862#post-105796</link>
			<pubDate>Tue, 19 Jul 2011 15:34:13 +0000</pubDate>
			<dc:creator>ThePacMan</dc:creator>
			<guid isPermaLink="false">105796@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Everyone!</p>
<p>So I have done some googling and searching for a setOpacity method for Particles. However I have not found any results.<br />
Is there any way to change the opacity on Particle Effects?</p>
<p>Thanks,<br />
Gavin
</p></description>
		</item>
		<item>
			<title>Osiris on "Particles &quot;Best Practices&quot;"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1579#post-9927</link>
			<pubDate>Sat, 29 Aug 2009 17:12:02 +0000</pubDate>
			<dc:creator>Osiris</dc:creator>
			<guid isPermaLink="false">9927@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm digging through the examples of particle effects.  Are there any "best practices" or documentation that tells me what  the varioous parameters do or how they affect the over all particle shower?</p>
<p>I have the following:</p>
<pre><code>ParticleSystem* emitter = [[ParticleSun alloc] initWithTotalParticles:500];
	[self addChild: emitter z:10];
	[emitter release];

	emitter.texture = [[TextureMgr sharedTextureMgr] addImage: @&#34;stars.png&#34;];
	//emitter.texture = particle;
	emitter.startSize = 10;
	emitter.duration = 1;
	emitter.lifeVar = 0;
	emitter.life = 1;
	emitter.speed = 100;
	emitter.speedVar = 0;
	emitter.emissionRate = 5000;
	emitter.position = myPoint;</code></pre>
<p>my problem is that  even though I chose "1" for duration, the entire EFX last at least 5 seconds?  I'm  also trying to discern the relationship between "emissionRate of 5000" and the "initWithTotalParticles" of 500?
</p></description>
		</item>
		<item>
			<title>mtran003 on "Preload/Cache Particles?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9658#post-55593</link>
			<pubDate>Fri, 17 Sep 2010 23:07:25 +0000</pubDate>
			<dc:creator>mtran003</dc:creator>
			<guid isPermaLink="false">55593@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm using particles from a plist I created with Particle Designer.  However, when I use them for the first time, my games stutters.</p>
<p>Is there an effective may to reload or cache particles, especially from plists, similar to the way you can pre-load sounds?
</p></description>
		</item>
		<item>
			<title>djones on "Motion Blur Filter applied to Particle Effects"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/16965#post-95629</link>
			<pubDate>Thu, 26 May 2011 10:39:15 +0000</pubDate>
			<dc:creator>djones</dc:creator>
			<guid isPermaLink="false">95629@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I want to turn this:</p>
<p><a href="http://twitpic.com/52oqcu/full" rel="nofollow">http://twitpic.com/52oqcu/full</a></p>
<p>into this:</p>
<p><a href="http://twitpic.com/52oqmb/full" rel="nofollow">http://twitpic.com/52oqmb/full</a></p>
<p>So it "bleeds" light pixels over to the next pixel. If a particle moves up and down it creates a trail of where it has gone.</p>
<p>This is for a space sort of game where I have 5 particle effects firing stars off at different speeds and sizes. So I need to have some sort of common filter I can apply to all of these layers.</p>
<p>How would you achieve such an effect? Thanks in advance.
</p></description>
		</item>
		<item>
			<title>itlgames on "Re-order particles system together with sprites off a batchnode"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/14747#post-83746</link>
			<pubDate>Mon, 21 Mar 2011 21:05:49 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">83746@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Riq, following the comment <a href="http://www.cocos2d-iphone.org/forum/topic/14636/page/2#post-83732">on this post</a>, I'm very interested to know how we can reorder set of sprites from a batchnode mixed with a particle system.</p>
<p>My case scenario is an isometric engine where I use the particles for effects on some tiles/objects and for shoots, and therefore when I re-oder my movable sprites, I need to be able to include as well the particles. Right now I can do this only if the sprites are not part of a batchnode, so I jsut add the particle as child of my sprite and all works fine.</p>
<p>But obviously the problem is the penalty I get on performance not using a batchnode. At the moment I can say I can run safely at 30fps in most situations without batchnodes, but I really would like to use one and improve performance.</p>
<p>I'm not good when it comes to openGL but if I get the idea I can try to implement the solution.
</p></description>
		</item>
		<item>
			<title>NOG on "Particles not rotating and using CCParticleSystemQuad"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17717#post-99413</link>
			<pubDate>Thu, 16 Jun 2011 17:29:27 +0000</pubDate>
			<dc:creator>NOG</dc:creator>
			<guid isPermaLink="false">99413@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is there any obvious reason why particles would be individually spinning in Particle Designer but not when I put the plist in my resources and test it in my program?  I'm using using CCParticleSystemQuad. Thanks.</p>
<p>Here's the property list as text:</p>
<p>{<br />
	angle = 0;<br />
	angleVariance = 0;<br />
	blendFuncDestination = 1;<br />
	blendFuncSource = 1;<br />
	duration = 0.300000011920929;<br />
	emitterType = 0;<br />
	finishColorAlpha = 1;<br />
	finishColorBlue = 1;<br />
	finishColorGreen = 1;<br />
	finishColorRed = 1;<br />
	"finishColorVarianceAlpha" = 0;<br />
	"finishColorVarianceBlue" = 0;<br />
	"finishColorVarianceGreen" = 0;<br />
	"finishColorVarianceRed" = 0;<br />
	finishParticleSize = 10.10526275634766;<br />
	"finishParticleSizeVariance" = 0;<br />
	gravityx = 0;<br />
	gravityy = -2171.052734375;<br />
	maxParticles = 5;<br />
	maxRadius = 100;<br />
	maxRadiusVariance = 0;<br />
	minRadius = 0;<br />
	particleLifespan = 0.5;<br />
	"particleLifespanVariance" = 0;<br />
	radialAccelVariance = 13.1578950881958;<br />
	radialAcceleration = 92.10526275634766;<br />
	rotatePerSecond = 0;<br />
	"rotatePerSecondVariance" = 0;<br />
	rotationEnd = -426.3157958984375;<br />
	rotationEndVariance = 236.8421020507812;<br />
	rotationStart = 331.5789489746094;<br />
	"rotationStartVariance" = 615.7894897460938;<br />
	"sourcePositionVariancex" = 2;<br />
	"sourcePositionVariancey" = -16;<br />
	sourcePositionx = 156;<br />
	sourcePositiony = 312;<br />
	speed = 0;<br />
	speedVariance = 296;<br />
	startColorAlpha = 1;<br />
	startColorBlue = 1;<br />
	startColorGreen = 1;<br />
	startColorRed = 1;<br />
	"startColorVarianceAlpha" = 0;<br />
	"startColorVarianceBlue" = 0;<br />
	"startColorVarianceGreen" = 0;<br />
	"startColorVarianceRed" = 0;<br />
	startParticleSize = 10.10526275634766;<br />
	"startParticleSizeVariance" = 6;<br />
	"tangentialAccelVariance" = 0;<br />
	"tangentialAcceleration" = 0;<br />
	textureFileName = "brick1LightV2.png";<br />
	textureImageData = "H4sIAAAAAAAAA+sM8HPn5ZLiYmBg4PX0cAkC0pwgzMEGJB9MZBMAUi6eLo4hEpLJf/7/t2dWPODiwegx<br />
T/XVhbwmt40NIfvi/kq4JLIuWriJJ8HVf53cwVUObrfZdPqu+xqc7ZnIXi5YIqx8tYmBocpcxCwlS0UPaB6Dp<br />
6ufyzqnhCYA4xy8on0AAAA=";<br />
}
</p></description>
		</item>

	</channel>
</rss>

