Jump to content

Collision emitter and object


i3Designer
 Share

Recommended Posts

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

 

 

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

  • 1 month later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...