Matthias Elephant Posted February 25, 2016 Share Posted February 25, 2016 Hi, i would like to use the emitter for some particles. The images are loaded in an atlas. I want to use an specific image from the atlas. In the examples i found this: http://phaser.io/examples/v2/particles/collision emitter.makeParticles('veggies', [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], 200, true, true); My problem is, that i dont know the index. But i know the framename. Someone know, how to use an emitter with atlas name and framename? Maybe there is a way to get the indexnumber from atlas if i know the framename? Thanks Link to comment Share on other sites More sharing options...
Zeterain Posted February 26, 2016 Share Posted February 26, 2016 Try just passing in the frame name instead of an array of frame numbers. For example: emitter.makeParticles('veggies', 'yourFrameName', 200, true, true); Link to comment Share on other sites More sharing options...
Matthias Elephant Posted February 26, 2016 Author Share Posted February 26, 2016 I tried that, but it did't work. The API also says, that i can just use a number.http://phaser.io/docs/2.4.6/Phaser.Particles.Arcade.Emitter.html#makeParticles More ideas? Link to comment Share on other sites More sharing options...
iKest Posted February 26, 2016 Share Posted February 26, 2016 You can try use the property .index of frame... Link to comment Share on other sites More sharing options...
Matthias Elephant Posted February 26, 2016 Author Share Posted February 26, 2016 (edited) Thanks. Solved with: var frame = this.game.cache.getFrameData("atlasName").getFrameByName("frameName"); emitter.makeParticles('atlasName', frame.index, 1, false, false); Edited February 26, 2016 by Matthias Elephant Link to comment Share on other sites More sharing options...
1-800-STAR-WARS Posted February 27, 2016 Share Posted February 27, 2016 You should also be able to pass frame names in an array: emitter.makeParticles('atlasName', ['frameName']); Link to comment Share on other sites More sharing options...
Recommended Posts