How can i make Particles when mouse pressed

pls help i need tthe code to make it when pressing mouse particles show
pls help me

Hi @Jesse_Gagne,

Check the following tutorial, it explains how to add logic to UI buttons. You can have your particles entity getting enabled when the onRelease event runs:

myParticlesEntity.enabled = true;

i dont understand it i need mouse down start particles but i try

Try following the tutorial, it explains how to execute some code on mouse down.

If you find it hard to understand the code, I’d suggest taking first some Javascript tutorials. There are plenty and freely available online.

will this code help at all with me

Click the text!

if not how mouse dawn

Nope, it will have to be coded in Javascript inside a PlayCanvas script, not in English.


how is mouse down code with start particles hard.

myPics.addEventListener('mousemove', e => {
  if (isDrawing === true) {
    drawLine(context, x, y, e.offsetX, e.offsetY);
    x = e.offsetX;
    y = e.offsetY;

might work right? idk if not

I am not sure what myPics is, but try following the way PlayCanvas input events are structured here, in the tutorial I’ve posted above:


show me an examle when i do it do i skip lines or what

maybe the fireBall following mouse is a good example. It has particleSystem, a mouse and is quite cool