import Phaser from 'phaser';

import { Powerup } from 'src/sprites/powerup';
import { PaddleEffect } from 'src/effects/paddle-effect';

export class Powerups extends Phaser.Group {
  constructor(game, spawnChance) {
    super(game, null, 'powerups', false, true, Phaser.Physics.ARCADE);
    this.classType = Powerup;
    this.spawnChance = spawnChance;

    this.types = [
      ['wider-paddle', new PaddleEffect({
        width: 150,
        tint: 0x22CC33,
      })],
      ['speed-up', new PaddleEffect({
        speed: 400,
        tint: 0x22CC33,
      })],
    ]
  }

  spawnFromBrick(brick) {
    const { worldPosition: position } = brick;
    if (this.game.rnd.frac() < this.spawnChance) {
      const powerup = new Powerup(this.game, position.x, position.y, ...this.game.rnd.pick(this.types))
      this.add(powerup);
      powerup.startMovement();
    }
  }
}

@@ -696,16 +696,19 @@
  %7B%0A     
+ //
  const p
@@ -803,16 +803,19 @@
 ))%0A     
+ //
  this.ad
@@ -826,16 +826,109 @@
 werup);%0A
+      const powerup = this.create(position.x, position.y, ...this.game.rnd.pick(this.types))%0A
       po

use group create