dthompson714 Posted January 14, 2015 Share Posted January 14, 2015 Hello,This forum has been a great source of knowledge as I work to create my first game with Phaser, Thank you! My question is regarding the angle of an emitter. I have a sprite that moves from one object to another, think missile fire, and i have an emitter set up to create a 'trail' but I can't figure out how to get my missile trail to be the same angle as my missile. Setting the emitter.angle (emitter.angle = 45;) seems to not only change the angle of the trail but also the path (and starting location) of the trail. It no longer follows the missile sprite.Removing the angle everything works and the trail follows the sprite but the angle of the trail is incorrect. Images show results of firing missile from white circle to random green circle.First image shows emitter with no emitter.angleSecond image shows emitter with emitter.angle = 45; (notice that emitter particle is rotated 45 degrees but the path has also been offset by 45 degrees) Missile = BlueEmitter = PinkNot sure code was needed but can supply if helpful. Any advise is appreciated,Thank you. Link to comment Share on other sites More sharing options...
dthompson714 Posted January 15, 2015 Author Share Posted January 15, 2015 UPDATE: I was able to achieve the effect I was looking for creating a Phaser.Line and then applying my 'trail' image with textureLine.Would still like to know if there is a solution I can try to angle the emitter as I like the flexibility of using particles instead of the Phaser.Line Thank you. Link to comment Share on other sites More sharing options...
ultimatematchthree Posted January 15, 2015 Share Posted January 15, 2015 Anyone feel free to correct me on this, but looking at the source code, it seems that particles always start with an angle of 0, and there seems to be no built-in way of changing this (if there were, this is the value you'll probably want to manipulate). As you have already observed, setting the emitter's angle doesn't accomplish what you intend, and this behavior is confirmed in the documentation. If you really want to use the Emitter class, you can add a property that will allow you to set a particle's starting angle (just add one line to Emitter.js) then use this value to set a particle's starting angle instead of 0, then set your particles' angular velocity to 0 so that they don't rotate. Link to comment Share on other sites More sharing options...
dthompson714 Posted January 15, 2015 Author Share Posted January 15, 2015 Thanks for the info Ultimatematchthree.I must have looked at the documentation 5 times and just glossed over "This has no impact on the rotation/angle properties of the children" I appreciate the help! Link to comment Share on other sites More sharing options...
Recommended Posts