kittykatattack / ga

The world's tiniest, cutest and funnest game engine
451 stars 85 forks source link

Using rectangle or circle as particle causes TypeError due to missing frames property #71

Open ghost opened 6 years ago

ghost commented 6 years ago

Returning a basic rectangle or circle from the spriteFunction in makeParticle() will cause an error. The error is also triggered if you don't provide a sprite function and rely on the default which returns g.circle(). It can be fixed by changing the code on line 2314 of plugins.js from:

      if (particle.frames.length > 0) {
        particle.gotoAndStop(randomInt(0, particle.frames.length - 1));
      }

to

      if (particle.frames && particle.frames.length > 0) {
        particle.gotoAndStop(randomInt(0, particle.frames.length - 1));
      }

This makes it possible to try out particle effects using simple built in primitives.