Today I want to share my Radial Explosion Class with you. It`s not perfect anyway but it may be a good help for you.
Main:
http://dl.dropbox.com/u/7098424/RadialExplosion.mm
Header:
http://dl.dropbox.com/u/7098424/RadialExplosion.h
Use it like that:
RadialExplosion* explosion = [RadialExplosion explosionAt:ccp(200,200) laenge:2 farbe:ccRED dauer:2 partikel:50 groesse:2 geschwindigkeit:0.15 abstand:0 typ:RELine zufall:YES richtung:REAround];
[self addChild:explosion z:gameZ tag:kTagExplosion];
[explosion explode];
Particle types are: RELine, RECircle, RETriangle, RERectangle
Predefined directions are: REAround, RETop, REBottom, RELeft, RERight
You can create your own directions like this:
#define REAround ccp(0,360) // starts at 0° (above the circle), particles in the next 360°
#define RETop ccp(-90,180) // starts at -90° (left from circle), particles spawn within next 180°
Something to the constructors:
+(id) explosionAt:(CGPoint)expPoint;
Specify only the point of explosion
+(id) explosionAt:(CGPoint)expPoint laenge:(int)len farbe:(ccColor3B)col dauer:(double)dur partikel:(uint)parts groesse:(double)big geschwindigkeit:(double)fast abstand:(double)off typ:(int)tp zufall:(bool)dirt richtung:(CGPoint)direction LinksUnten:(CGPoint)bl RechtsUnten:(CGPoint)br LinksOben:(CGPoint)tl RechtsOben:(CGPoint)tr;
expPoint = the point of explosion
laenge = length of particles
farbe = color
dauer = duration
partikel = how many particles you want to display
groesse = width of particles
geschwindigkeit = speed (should be something < 1)
abstand = offset of particles to the mid point of explosion
typ = RELine etc.
zufall = adjust particles more randomly (adjustes the offset of aech particle)
richtung = direction (e.g. REAround etc.)
LinksOben = Edge Top Left of the border
LinksUnten = Edge Bottom Left of the border
RechtsOben = Edge Top right of the border
RechtsUnten = Edge Bottom right of the border
+(id) explosionAt:(CGPoint)expPoint laenge:(int)len farbe:(ccColor3B)col dauer:(double)dur partikel:(uint)parts groesse:(double)big geschwindigkeit:(double)fast abstand:(double)off typ:(int)tp zufall:(bool)dirt richtung:(CGPoint)direction;Same as above, but without specified Border. ( Is set to default screen borders )
Here is an example:
(Please excuse the stretching of the video, don`t know how to adjust the screening program ^^)
If you still have some questions feel free to ask, or if you have some suggestions feel free to comment
Thx







