Jump to content

Strange Audio Bug


OIJOIJidontknow
 Share

Recommended Posts

Hi,

I'm having the strangest  bug with Phaser 3s Particle System... I'm running Chrome on MacOS. Bug isn't happening on Firefox on MacOS.

Steps to reproduce:

1. Listen to music on either Google Music or Spotify in another Tab (YouTube doesn't work).

2. Run a Phaser 3 Game in the Active Tab that creates Particles that go out of the game canvas.

3. Music starts to break down (sounds like framedrops and playback slows down).

 

Here some code that you can paste here to get started quickly:

var config = {
        type: Phaser.AUTO,
        width: 800,
        height: 600,
        scene: {
            preload: preload,
            create: create
        }
    };

    var game = new Phaser.Game(config);

    function preload ()
    {
      this.load.setBaseURL('http://examples.phaser.io');

      this.load.image('bg', 'assets/skies/deep-space.jpg');
      this.load.spritesheet('waters', 'assets/sprites/waters.png', {frameWidth: 32, frameHeight: 400});
      this.load.image('explosion', 'assets/sprites/explosion.png');
    }

    function create ()
    {

      var bgimg = this.add.image(400, 300, 'bg');
      bgimg.scaleX = 800 / bgimg.width;
      bgimg.scaleY = 600 / bgimg.height;

      var waters = [];
      for (var i = 0; i < 26; i++) {
        var water = this.add.sprite(i*32+16, 500, 'waters');
        waters.push(water);
      }

      var particles = this.add.particles('explosion');
      console.log(particles.createEmitter);
      var emitter = particles.createEmitter({
        speed: 100,
        blendMode: "ADD",
        scale: {start: 0.5, end: 3},
        alpha: {start: 1, end: 0},
        x: 400,
        y: 300
      });

      this.anims.create({
        key: 'waves0',
        frames: this.anims.generateFrameNumbers('waters', {frames: [0, 1, 2, 3, 2, 1]}),
        frameRate: 10,
        repeat: -1
      });
      for (var i = 0; i < 26; i++) {
          waters[i].anims.play("waves0", true);
      }
    }

 

If anyone could reproduce this, that would be great for my sanity...

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