Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

phaser random triangle

 preload ()
    {
        this.load.image('orb', 'assets/sprites/orb-blue.png');
    }

    create ()
    {
        //  Create 300 sprites (they all start life at 0x0)
        const group = this.add.group({ key: 'orb', frameQuantity: 300 });

        const triangle = new Phaser.Geom.Triangle.BuildEquilateral(400, 100, 380);
        // var triangle = new Phaser.Geom.Triangle.BuildRight(200, 400, 300, 200);

        //  Randomly position the sprites within the triangle
        Phaser.Actions.RandomTriangle(group.getChildren(), triangle);
    }
Source by github.com #
 
PREVIOUS NEXT
Tagged: #phaser #random #triangle
ADD COMMENT
Topic
Name
5+2 =