diff --git a/docs/06 In Practice/2D-Game/06 Particles.md b/docs/06 In Practice/2D-Game/06 Particles.md index 91329db..b13fe1a 100644 --- a/docs/06 In Practice/2D-Game/06 Particles.md +++ b/docs/06 In Practice/2D-Game/06 Particles.md @@ -108,7 +108,7 @@ for (GLuint i = 0; i < nr_particles; ++i) p.Color.a -= dt * 2.5; } } -```c++ +``` 第一个循环看起来可能有点吓人。因为这些粒子会随着时间消亡,我们就想在每一帧里面产生`nr_new_particles`个新粒子。但是一开始我们就知道了总的粒子数量是`nr_partiles`,所以我们不能简单的往粒子数组里面添加新的粒子。否则的话我们很快就会得到一个装满成千上万个粒子的数组,考虑到这个粒子数组里面其实只有一小部分粒子是存活的,这样就太浪费效率了。