# Help with particles

**URL:** <https://forum.kirupa.com/t/help-with-particles/118587>\
**Category:** Uncategorized\
**Created:** [August 6, 2004, 11:22pm UTC](https://forum.kirupa.com/t/help-with-particles/118587 "2004-08-06T23:22:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thinker2501](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Thinker2501](https://forum.kirupa.com/u/Thinker2501)\
**Post date:** [August 6, 2004, 11:22pm UTC](https://forum.kirupa.com/t/help-with-particles/118587/1 "2004-08-06T23:22:06Z")

</div>

I’m trying to make a basic particle system and am running into a pretty simple problem I just can’t seem to find the answer to. For some reason none of the particles are moving. Here is my basic code just to start:

onClipEvent (enterFrame) {  
i = 0;  
totalParticles = 10;  
gravity = 1;  
}  
onClipEvent (enterFrame) {  
for (i; i\<totalParticles;i++) {  
attachMovie (“particle”, “particle” + i, i);  
\_root.emitter[“particle”+i].xSpeed = random(5);  
\_root.emitter[“particle”+i].ySpeed = -5;  
\_root.emitter[“particle”+i].onEnterFrame = function () {  
ySpeed = ySpeed + gravity;  
this.\_x += xSpeed;  
this.\_y += ySpeed;  
}  
}  
}

I’m sure the answer is pretty easy I just can’t seem to see it. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![shortcut06](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@shortcut06](https://forum.kirupa.com/u/shortcut06)\
**Post date:** [August 7, 2004, 12:54am UTC](https://forum.kirupa.com/t/help-with-particles/118587/2 "2004-08-07T00:54:39Z")

</div>

Fixed :

```auto
 
onClipEvent ( **load** ) {
 i = 0;
 totalParticles = 10;
 gravity = 1;
}

onClipEvent (enterFrame) {
 for (i; i<totalParticles;i++) {
  **_root.emitter.** attachMovie ("particle", "particle" + i, i);
  _root.emitter["particle"+i].onEnterFrame = function () {
** xSpeed = random(5);
   ySpeed = -5;**
   ySpeed = ySpeed + gravity;
   this._x += xSpeed;
   this._y += ySpeed;
  }
 }
}

```

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 7, 2004, 12:58am UTC](https://forum.kirupa.com/t/help-with-particles/118587/3 "2004-08-07T00:58:19Z")

</div>

use this code only:

```auto

onClipEvent(load)
{
	var totalParticles = 10;
	var gravity = 1;
	
	for (var i = 0; i < totalParticles; i++) 
	{
		attachMovie ("particle", "particle" + i, i);
		_root.emitter["particle"+i].xSpeed = random(5);
		_root.emitter["particle"+i].ySpeed = -5;
		
		_root.emitter["particle"+i].onLoad = function()
		{
			var xSpeed = 0;
			var ySpeed = 0;
		}
		
		_root.emitter["particle"+i].onEnterFrame = function () 
		{
			this.ySpeed = this.ySpeed + gravity;
			this._x += this.xSpeed;
			this._y += this.ySpeed;
		}
	}
}

```

-Jake

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 7, 2004, 1:00am UTC](https://forum.kirupa.com/t/help-with-particles/118587/4 "2004-08-07T01:00:18Z")

</div>

also random(number) is a depreciated function. use this to achieve the same effect:

```auto

_root.emitter["particle"+i].xSpeed = Math.random() * 5

```

---

<div class="post-metadata">

**Author:** ![Dunga](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dunga](https://forum.kirupa.com/u/Dunga)\
**Post date:** [August 7, 2004, 4:14am UTC](https://forum.kirupa.com/t/help-with-particles/118587/5 "2004-08-07T04:14:26Z")

</div>

Here is my version, with dragging and bouncing particles!

[http://roy.wigginsworld.org/Particle](http://roy.wigginsworld.org/Particle) System.fla

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 7, 2004, 4:16am UTC](https://forum.kirupa.com/t/help-with-particles/118587/6 "2004-08-07T04:16:03Z")

</div>

> [@Dunga](#):
>
> Here is my version, with dragging and bouncing particles!
> 
> [http://roy.wigginsworld.org/Particle](http://roy.wigginsworld.org/Particle) System.fla

link doesn’t work?

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 7, 2004, 4:19am UTC](https://forum.kirupa.com/t/help-with-particles/118587/7 "2004-08-07T04:19:18Z")

</div>

ah I got it. Looks cool!

-jake

---

<div class="post-metadata">

**Author:** ![Dunga](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dunga](https://forum.kirupa.com/u/Dunga)\
**Post date:** [August 7, 2004, 4:41pm UTC](https://forum.kirupa.com/t/help-with-particles/118587/8 "2004-08-07T16:41:15Z")

</div>

Its because I was too lazy to tell the forum the whole thing was a link, and I forgot whatever the “code” for a space was… anyway, I’m glad you like it.

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 7, 2004, 5:13pm UTC](https://forum.kirupa.com/t/help-with-particles/118587/9 "2004-08-07T17:13:54Z")

</div>

%20 = space

---

<div class="post-metadata">

**Author:** ![Dunga](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dunga](https://forum.kirupa.com/u/Dunga)\
**Post date:** [August 8, 2004, 1:54am UTC](https://forum.kirupa.com/t/help-with-particles/118587/10 "2004-08-08T01:54:05Z")

</div>

Ah, right.

---

<div class="post-metadata">

**Author:** ![Gupps](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@Gupps](https://forum.kirupa.com/u/Gupps)\
**Post date:** [August 9, 2004, 3:49am UTC](https://forum.kirupa.com/t/help-with-particles/118587/11 "2004-08-09T03:49:03Z")

</div>

hi dunga, I can’t find your fla in your site  
by the way cool animation
