# Particle candy

**URL:** <https://forums.solar2d.com/t/particle-candy/319214>\
**Category:** Particle Candy / Text Candy\
**Created:** [October 24, 2013, 12:45pm UTC](https://forums.solar2d.com/t/particle-candy/319214 "2013-10-24T12:45:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harryjnewton](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/bc8723/32.png) [@harryjnewton](https://forums.solar2d.com/u/harryjnewton)\
**Post date:** [October 24, 2013, 12:45pm UTC](https://forums.solar2d.com/t/particle-candy/319214/1 "2013-10-24T12:45:48Z")

</div>

at the moment i am experimenting with particle candy and i have ran into a couple of problems. I am trying to create a function were i am trying to remove a particle when it touches/ falls on another particle, here it is. I cannot get this to seem to work so please help me!.

```
&nbsp;local function &nbsp;Collision(event) &nbsp; &nbsp; &nbsp; &nbsp; phase = event.phase &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if phase == "began" then &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;AsteroidParticles:removeSelf()--Asteroid particles is the name of the particle &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; end&nbsp; &nbsp; &nbsp; &nbsp; cartBody:addEventListener("collision",Collision)&nbsp; --cartBody is the object that is listening for the collision, so when the asteroid touches the object it disappears &nbsp;
```

---

<div class="post-metadata">

**Author:** ![bjsorrentino](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@bjsorrentino](https://forums.solar2d.com/u/bjsorrentino)\
**Post date:** [October 24, 2013, 10:30pm UTC](https://forums.solar2d.com/t/particle-candy/319214/2 "2013-10-24T22:30:54Z")

</div>

Hi @harryjnewton,

I’ve moved this topic to the Particle Candy sub-forum, so it’s more focused and you should get the assistance you need.

Best regards,

Brent Sorrentino

---

<div class="post-metadata">

**Author:** ![harryjnewton](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/bc8723/32.png) [@harryjnewton](https://forums.solar2d.com/u/harryjnewton)\
**Post date:** [October 25, 2013, 11:35pm UTC](https://forums.solar2d.com/t/particle-candy/319214/3 "2013-10-25T23:35:09Z")

</div>

thanks so much Brent, helps a lot

---

<div class="post-metadata">

**Author:** ![Stephen\_Lewis](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/54ee81/32.png) [@Stephen\_Lewis](https://forums.solar2d.com/u/Stephen_Lewis)\
**Post date:** [October 26, 2013, 1:09am UTC](https://forums.solar2d.com/t/particle-candy/319214/4 "2013-10-26T01:09:05Z")

</div>

From what I recall, to delete a particle if using Particle Candy you are \_not&nbsp;\_supposed to use removeSelf(). &nbsp;The “officially” recommended way is to set the killTime to the current time and thus Particle Candy will automatically remove it. &nbsp;Like so:

```
event.target.killTime = system.getTimer() &nbsp;

```

If that doesn’t work you can also try setting the particle scale to smaller than .001 since Particle Candy automatically removes any particle smaller than that, like so:

```
event.target.scale = 0.0001 &nbsp;

```

That is how I do it and it works for me.

---

<div class="post-metadata">

**Author:** ![bjsorrentino](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@bjsorrentino](https://forums.solar2d.com/u/bjsorrentino)\
**Post date:** [October 24, 2013, 10:30pm UTC](https://forums.solar2d.com/t/particle-candy/319214/5 "2013-10-24T22:30:54Z")

</div>

Hi @harryjnewton,

I’ve moved this topic to the Particle Candy sub-forum, so it’s more focused and you should get the assistance you need.

Best regards,

Brent Sorrentino

---

<div class="post-metadata">

**Author:** ![harryjnewton](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/bc8723/32.png) [@harryjnewton](https://forums.solar2d.com/u/harryjnewton)\
**Post date:** [October 25, 2013, 11:35pm UTC](https://forums.solar2d.com/t/particle-candy/319214/6 "2013-10-25T23:35:09Z")

</div>

thanks so much Brent, helps a lot

---

<div class="post-metadata">

**Author:** ![Stephen\_Lewis](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/54ee81/32.png) [@Stephen\_Lewis](https://forums.solar2d.com/u/Stephen_Lewis)\
**Post date:** [October 26, 2013, 1:09am UTC](https://forums.solar2d.com/t/particle-candy/319214/7 "2013-10-26T01:09:05Z")

</div>

From what I recall, to delete a particle if using Particle Candy you are \_not&nbsp;\_supposed to use removeSelf(). &nbsp;The “officially” recommended way is to set the killTime to the current time and thus Particle Candy will automatically remove it. &nbsp;Like so:

```
event.target.killTime = system.getTimer() &nbsp;

```

If that doesn’t work you can also try setting the particle scale to smaller than .001 since Particle Candy automatically removes any particle smaller than that, like so:

```
event.target.scale = 0.0001 &nbsp;

```

That is how I do it and it works for me.
