Particle systems
I have a working particle system using a particle class named CParticle and one that handles most of the stuff called. I''m going to have several different types of particles, so I need to know if I should make a different particle and particle system class for each or if I can reuse them somehow. How is this generally done?
I wrote a general particle system class that loaded various settings (start/end scale/velocity/acceleration/colour/etc) and worked like that.
At present, I have implemented each system with specific classes as I''m giving the particle systems different behaviours.
When I get my scripting system working, I''ll have the particle system control the particles from a default class and use the scripting to control colour/motion etc.
At present, I have implemented each system with specific classes as I''m giving the particle systems different behaviours.
When I get my scripting system working, I''ll have the particle system control the particles from a default class and use the scripting to control colour/motion etc.
Although there are different ways, it''s always best to keep your code as clean as possible, so try to have only one generic class which supports almost all your needs, including winds, acceleratin, collision, color, ... Of course you can add some other features later. Just be careful, when you don''t need a special feature, don''t take use of it, in this way you can build up later on your last codes.
game/software developer/algorithm designer
game/software developer/algorithm designer
Would you then recommend having CParticle have a member variable thats an enum or something that says what type it is, then do a switch statement in the update method to do the appropriate update?
quote:Original post by timmay314use polymorphism
Would you then recommend having CParticle have a member variable thats an enum or something that says what type it is, then do a switch statement in the update method to do the appropriate update?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement