small fish Posted March 27, 2014 Share Posted March 27, 2014 Hi, I'm not an expert but I don't think this is my code. I have a few physics objects and class attached to them with emitters and the start() in a prototype. It used to work in 1.6. I am currently trying to get my game to work in 2. Anyway I get this error: TypeError: particle.body is null, when Exists is set to false. otherwise if true no error and everything shows top left but no emitte. emitter.create(0, 0, 'spritesheet', frames, false); Link to comment Share on other sites More sharing options...
small fish Posted March 28, 2014 Author Share Posted March 28, 2014 ok not sure how much sence this will make but here goes. I have changed the code quite a bit from what it is functionaly for brevity. I just want to try and get the idea across in the hope that someone can tell me that my code is all wrong or that something isn't right with the emitter. As I say it seems to work fine in 1.6 but as I am just finding my way with js, it could just be my lack of understanding. Just to repeat. I get the error if I run with "em = this.aEm.create(0, 0, 'spritesheet', frames, false);" but if true it doesn't error but it also doesn't emitte anything, they just sit top left. Anyway thanks and by the way I have been fooling around with Phaser for a few months now and love it : )great work, so awesome. Emitte = function(t) { t.game.physics.startSystem(Phaser.Physics.ARCADE); this.aEm = []; aE = [ ['bubbles0000', null, -90], ['bubbles0001', null, -90], ['bones000', 5, 90] ]; for(var i = 0; i < aE.length; i++) { this.aEm[i] = t.game.add.emitter(0, 0); for(var j = 0; j < aE[i][5]; j++) { em = this.aEm[i].create(0, 0, 'spritesheet', frames, true); em.animations.frameName = aE[i][0]; }; }; }; Emitte.prototype.Start = function(e, pos, time, num) { this.aEm[e].start(true, time, null, num); }; this.sinkGrp = this.game.add.group(); for(var i = 0; i < 4; i++) { var s = this.sinkGrp.create(this.rand(true, 800, 0), 200, 'spritesheet'); s.EmFx = new Emitte(this); }; Link to comment Share on other sites More sharing options...
Recommended Posts