soulVampire Posted December 16, 2020 Share Posted December 16, 2020 I have an emitter in the game that called when the player moves left as a test of dust particles the code for calling the emitter is as follows /************************/ /* left player movement */ /************************/ case player_states.player_facing_left: this.body.setMaxVelocity(2, 10); this.body.force.y = 0; this.body.force.x = 0; // update the default force this.body.vel.x -= this.body.maxVel.x * me.timer.tick; // flip the sprite on horizontal axis this.renderable.flipX(true); // change to the walking left animation if (!this.renderable.isCurrentAnimation("walk")) { this.body.removeShape(this.body.getShape(0)); this.body.addShape(new me.Rect(0, 0, 22, 57)); this.anchorPoint.set(0.5, 0.5); this.renderable.setCurrentAnimation("walk"); this.playerDustTrails(this.pos.x,this.pos.y); } break; then when the player moves left this code is called to create the emitter and draw a dust particles as the player moves over the ground /*********************************/ /* dust particle emitter handler */ /*********************************/ playerDustTrails: function(player_xPos, player_yPos) { console.log("here in dust " + Math.floor(player_xPos)); this.image = me.loader.getImage("dust_particle"); this.player_dust_emitter = new me.ParticleEmitter(Math.floor(player_xPos), Math.floor(player_yPos), { image: this.image, totalParticles: 1, angle: 3.142, minLife: 1000, maxLife: 3000, speedVariation: 0, maxParticles: 1, frequency: 10, duration: 300 }); this.player_dust_emitter.z = 100 me.game.world.addChild(this.player_dust_emitter, 100); this.player_dust_emitter.burstParticles(); me.game.world.removeChild(this.player_dust_emitter); }, but when its added to the game world nothing is displayed no dust, but I have checked the code with examples and there seems nothing wrong, but no dust, image is loaded fine as no error when loading image so thats fine, but unable to see where the error is...it should work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.