Skip to main content

Phaser 3 physics group with circle

I'm fairly new to Phaser, and am following this tutorial: https://www.codecaptain.io/blog/game-development/shooting-bullets-phaser-3-using-arcade-physics-groups/696

Except, that instead of the Laser being a Sprite, I just want it to be a simple circle, so I tried the following;

export class Laser extends Phaser.Physics.Arcade.Body {
    constructor(scene: Phaser.Scene, x: number, y: number) {
        const c = new Phaser.GameObjects.Ellipse(scene, x, y, 25, 25, 0x00ff00);

        super(scene.physics.world, c);
    }
}

This just throws the following error Uncaught TypeError: child.addToDisplayList is not a function.

Am I missing something fairly fundamental here? I can only seem to be able to use Phaser.Physics.Arcade.Sprite or Phaser.Physics.Arcade.Image. Is it not possible to just have a physics object that consist of multiple rectangles or circles?

Via Active questions tagged javascript - Stack Overflow https://ift.tt/gYJHezQ

Comments