Jump to content

Particles Question


Ninjadoodle
 Share

Recommended Posts

Hi @enpu

I have a couple of problems with particles. These could be my fault but I just can't see what I'm doing wrong :(

Firstly, the particles are loading the wrong image, instead of the one I tell it too (in my case they are loading half of a bottle sprite, instead of the shard image).

And second, I can't seem to set the x, y position. The particles always appear at 0, 0, no matter what I set the position to.

game.createClass('S06Shard', {
    
    init: function(x, y) {
        
        this.particles = new game.Particles();
        this.particles.textures.push('s06Shard.png');
        this.particles.position.set(x, y);
        this.particles.emitRate = 0;
        this.particles.angleVar = 0;
        this.particles.accelSpeed = 200;
        this.particles.speed = 100;
        this.particles.life = 1000;
        this.particles.addTo(game.scene.fg);
        
        this.fire();
    },
    
    fire: function() {
        
        var count = 4;
        
        for (var i = 0; i < count; i++) {
            this.particles.angle = -Math.PI;
            this.particles.angleVar = Math.PI;
            this.particles.emit();
        }
    }
});

 

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...