ctmartinez1992 Posted September 24, 2014 Share Posted September 24, 2014 Hi, i have this code that i straight up copied from the the phaser examples: //Rain this.emitter = game.add.emitter(400, 0, 400); this.emitter.width = this.game.width; this.emitter.makeParticles('rain'); this.emitter.minParticleScale = 0.1; this.emitter.maxParticleScale = 0.5; this.emitter.setYSpeed(300, 500); this.emitter.setXSpeed(-5, 5); this.emitter.minRotation = 0; this.emitter.maxRotation = 0; this.emitter.start(false, 1600, 5, 0); //Arcade physics this.game.physics.arcade.gravity.y = GRAVITY;Basically, it's just simulating rain. However, it seems that the arcade gravity is also applied to the emitter because if i comment the gravity line, the rain works fine. I can't seem to find a way to apply a custom gravity to rain.Is there any solution? Thanks in advance. Link to comment Share on other sites More sharing options...
lewster32 Posted September 24, 2014 Share Posted September 24, 2014 The Emitter object also has a gravity property which will set the gravity on each particle. I believe this will override the global gravity setting. Link to comment Share on other sites More sharing options...
ctmartinez1992 Posted September 25, 2014 Author Share Posted September 25, 2014 You would think so, but changing that property does nothing. I tried put it before starting the emitter, after starting the emitter, on the update, nothing works. I can't find anything relevant on the source code and looking at my code. This is the only time i use gravity parameters and as soon as i comment the arcade gravity line, it works just fine. Link to comment Share on other sites More sharing options...
lewster32 Posted September 25, 2014 Share Posted September 25, 2014 You don't need to specify a global gravity - you could apply it on a per-sprite basis; so comment out the line and then for any sprites which do need gravity, just apply it to their body. Link to comment Share on other sites More sharing options...
Recommended Posts