i3Designer Posted April 9, 2014 Share Posted April 9, 2014 I use: normandy.body.createBodyCallback(emitter_ast1, kill, this);normandy is the ship and then there is the emitter, but it should not be.What can I use? I Use 2.0.2 Phaser version Link to comment Share on other sites More sharing options...
Heppell08 Posted April 10, 2014 Share Posted April 10, 2014 http://docs.phaser.io/Phaser.Physics.P2.Body.html#createBodyCallback Link to comment Share on other sites More sharing options...
i3Designer Posted April 11, 2014 Author Share Posted April 11, 2014 I Use this, But I errors.This is My code:Create { game.physics.startSystem(Phaser.Physics.P2JS); normandy = game.add.sprite(150,520,'nave'); normandy.anchor.setTo(0.5, 0.5); game.physics.p2.enable(normandy,true); normandy.body.clearShapes(); normandy.body.loadPolygon('physicsData', 'normandy'); emitter_meteorite1 = game.add.emitter(game.world.centerX,-50,300); emitter_meteorite1.width=game.world.width; emitter_meteorite1.makeParticles('meteorite1'); emitter_meteorite1.minParticleScale=0.5; emitter_meteorite1.maxParticleScale=0.8; emitter_meteorite1.setYSpeed(300,400); emitter_meteorite1.setXSpeed(-5, 5); emitter_meteorite1.minRotation=50; // la rotazione va da 0 a 100 emitter_meteorite1.maxRotation=80; emitter_meteorite1.gravity=0; emitter_meteorite1.start(false,6000,(1500,1700),0); and more? } I do not like to ask, but can not find solutions when I turn to the forum Link to comment Share on other sites More sharing options...
Heppell08 Posted April 11, 2014 Share Posted April 11, 2014 Check this out: Phaser: Attach Particle Emitter to a sprite [CodePen] The most important thing to take away is that you can add any game object to a sprite with: sprite.addChild(gameObject); http://www.html5gamedevs.com/topic/5549-anchor-emitter-to-sprite/ Codevinsky has an emitter working. He just does: Sprite.addChild(emitter); Look at his codepen and example. Thats where your answer most likely lies. Link to comment Share on other sites More sharing options...
i3Designer Posted April 11, 2014 Author Share Posted April 11, 2014 Ok now I feel, but what I want to do and create a function that is activated when a sprite touches an emitter. Now test and let you know Link to comment Share on other sites More sharing options...
rich Posted April 11, 2014 Share Posted April 11, 2014 At the moment the Emitters are designed to work with Arcade Physics only I'm afraid. You could extend the Emitter and enable it for P2, but it would require messing around internally a little bit. Link to comment Share on other sites More sharing options...
i3Designer Posted April 11, 2014 Author Share Posted April 11, 2014 So at the moment I should use a little more old versions? Link to comment Share on other sites More sharing options...
i3Designer Posted April 11, 2014 Author Share Posted April 11, 2014 I resolved when i used the version 2.0.3 with phaser.Arcade Perfect Link to comment Share on other sites More sharing options...
prateek.pradeep Posted May 12, 2014 Share Posted May 12, 2014 Hey, how did you get collision callback between an emitter particle and sprite ?Please tell me? Link to comment Share on other sites More sharing options...
Recommended Posts