Worklog for Ked
JipParticles
Return to Worklogs
| ||
As of January 30, 2010, I've been (somewhat) working on a particle
system for BlitzMax. I intend to make it easy to use and relatively
powerful, but we'll see about that last part. :) The particle system is split up into 4 different types: TEmitPoint, TParticle, TParticleAttributes, and TParticleEffect. TEmitPoint is simply the emitter for the particle effect. TParticle is, of course, the particle that is emitted from the emitter. TParticleAttributes is used to set the behavior of the particles of an emitter. Like to set the speed, alpha, rotation, scale, color, life amount, emit delay, maximum amount of particles to be emitted at a time, and a lot more. TParticleEffect is what you would build your own particle effect on. (You are allowed 10 emitters per particle effect.) For example, this is what my fire particle effect looks like: Type TFireEffect Extends TParticleEffect Final Method Create:TFireEffect() 'initialize Init(False,3) 'layer 1 Local a:TParticleAttributes=New TParticleAttributes a.LoadFromFile("incbin::fire_data/flames.dat") SetLayerAttributes(1,a) 'layer 2 Local b:TParticleAttributes=New TParticleAttributes b.LoadFromFile("incbin::fire_data/smoke.dat") SetLayerAttributes(2,b) 'layer 3 Local c:TParticleAttributes=New TParticleAttributes c.LoadFromFile("incbin::fire_data/sparks.dat") SetLayerAttributes(3,c) 'play StartEffect() Return Self EndMethod EndType Function CreateFireEffect:TFireEffect() Return New TFireEffect.Create() EndFunctionAnd that's it! You have a full-blown particle effect. To see my particle demos that I've released so far, go here: http://www.blitzbasic.com/Community/posts.php?topic=88848 Ked Windows XP | NVIDIA GeForce 8500 GT | AMD Athlon 64 X2 Dual Core 4400+ 2.3 Ghz BlitzMax | MaxGUI |