Jump to content

SoulVampire


soulVampire
 Share

Recommended Posts

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(210);
        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(002257));
          this.anchorPoint.set(0.50.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_xPosplayer_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_emitter100);
    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

 

 

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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