# Particles cause lag

**URL:** https://forum.kirupa.com/t/particles-cause-lag/321552
**Category:** flash
**Created:** [April 22, 2011, 8:27pm UTC](https://forum.kirupa.com/t/particles-cause-lag/321552 "2011-04-22T20:27:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![John4213](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@John4213](https://forum.kirupa.com/u/John4213)
#### Post date: [April 22, 2011, 8:27pm UTC](https://forum.kirupa.com/t/particles-cause-lag/321552/1 "2011-04-22T20:27:01Z")

</div>

Hey, I’ve made it so when you die in my game, you explode into 20 particles which usually lags the game, especially if it’s being played in a browser.

I’m pretty sure that it’s just because of the graphics, but has anyone got any idea why it’s causing so much lag? I’ve included the AS2 just encase, but I’m pretty sure that isn’t the problem. Thanks.

Code:

//variables  
fall = -8;

onEnterFrame = function () {  
\_y += fall;  
fall += .40;  
//on land  
while (\_root.terrain.hitTest(\_x, \_y, true)) {  
onterrain = true;  
this.swapDepths(99);  
this.removeMovieClip(99);  
}  
};
