Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser stagger play 1

    preload ()
    {
        this.load.spritesheet('diamonds', 'assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 });
    }

    create ()
    {
        const config = {
            key: 'flash',
            frames: this.anims.generateFrameNumbers('diamonds', { start: 0, end: 4 }),
            frameRate: 1,
            repeat: -1
        };

        this.anims.create(config);

        const group = this.add.group();

        group.createMultiple({ key: 'diamonds', frame: 0, repeat: 279 });

        Phaser.Actions.GridAlign(group.getChildren(), { width: 20, height: 20, cellWidth: 38, x: 38, y: 50 });

        this.anims.staggerPlay('flash', group.getChildren(), 60);
    }
Comment

phaser stagger play 2

 preload ()
    {
        this.load.atlas('lazer', 'assets/animations/lazer/lazer.png', 'assets/animations/lazer/lazer.json');
    }

    create ()
    {
        this.anims.create({ key: 'blast', frames: this.anims.generateFrameNames('lazer', { prefix: 'lazer_', start: 0, end: 22, zeroPad: 2 }), repeat: -1 });

        var group = this.add.group();

        group.createMultiple({ key: 'lazer', frame: 'lazer_22', repeat: 39, setScale: { x: 0.25, y: 0.25 } });

        Phaser.Actions.GridAlign(group.getChildren(), {
            width: 20,
            height: 2,
            cellWidth: 32,
            cellHeight: 280,
            x: -50,
            y: -220
        });

        this.anims.staggerPlay('blast', group.getChildren(), 20);
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: Counting Duplicates 
Javascript :: react-native-fbsdk-next 
Javascript :: closre in js 
Javascript :: refresh secounds 
Javascript :: how to process string calculation in gdscript 
Javascript :: remove text and keep div inside a div jquery 
Javascript :: JS table with rows that have alternating colours 
Javascript :: how to map elements from 1st object react js 
Javascript :: string variable 
Javascript :: nodejs: send html file to show in Browser 
Javascript :: spiral traversal clockwise direction js 
Javascript :: get elements by class name wildcard 
Javascript :: string concat in js 
Javascript :: js function expression 
Javascript :: last five characters of string javascript 
Javascript :: js brightness filter 
Javascript :: queryselector j 
Javascript :: javascript learning 
Javascript :: javascript load content from file 
Javascript :: JavaScript HTML DOM Events 
Javascript :: change url without reloading the page 
Javascript :: javascript autocomplete 
Javascript :: javascript set header text 
Javascript :: javascript quiz questions and answers 
Javascript :: ilan mask 
Javascript :: hide react source 
Javascript :: toggle div javascript 
Javascript :: difference between dom and react dom 
Javascript :: react validate 
Javascript :: hasOwnProperty.call js 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =