Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsednihp

Posted 12 October 2012 - 05:40 PM

Don't create a particle every time it moves, no, but you could create one randomly on movement. The particle then controls it's own movement and animates itself (if so called for) until it's lifetime expires, at which time it is destroyed. All of this management should be done in the particle manager class, with a check done to see if a particle is still alive and needs to be removed in the game's code, i.e.

[source lang="cpp"]for(auto particle : particles){ if( particle.isDead() ) //erase particle code here else particle.update();}[/source]

#2sednihp

Posted 12 October 2012 - 05:40 PM

Don't create a particle every time it moves, no, but you could create one randomly on movement. The particle then controls it's own movement and animates itself (if so called for) until it's lifetime expires, at which time it is destroyed. All of this management should be done in the particle manager class, with a check done to see if a particle is still alive and needs to be removed in the game's code, i.e.

[source lang="cpp"]for(auto particle : particles){ if( particle.isDead() ) //erase particle code here else particle.update()}[/source]

#1sednihp

Posted 12 October 2012 - 05:39 PM

Don't create a particle every time it moves, no, but you could create one randomly on movement. The particle then controls it's own movement and animates itself (if so called for) until it's lifetime expires, at which time it is destroyed. All of this management should be done in the particle manager class, with a check done to see if a particle is still alive and needs to be removed in the game's code, i.e.

[source lang="cpp"]for(auto particle : particles){ if( particle.isDead() ) //erase particle code here else //animate and move particle code goes here}[/source]

PARTNERS