Blitter Alpha

Demonstrates how to adjust the alpha transparency of individual Bobs within a Blitter object.

Blitter Alpha, running
1024 × 768
GitHub
class Example extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.image('atari', 'assets/sprites/atari130xe.png');
    }

    create ()
    {
        const blitter = this.add.blitter(0, 0, 'atari');

        //  Change the alpha of each Bob as its created

        blitter.create(0, 0).setAlpha(1);

        blitter.create(200, 50).setAlpha(0.8);

        blitter.create(400, 100).setAlpha(0.5);

        blitter.create(600, 150).setAlpha(0.2);
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.CANVAS,
    parent: 'game-container',
    scene: Example
};

const game = new Phaser.Game(config);

More in Blitter17 examples