Skip to content

Instantly share code, notes, and snippets.

@photonstorm
Last active February 21, 2024 05:27
Show Gist options
  • Save photonstorm/46cb8fb4b19fc7717dcad514cdcec064 to your computer and use it in GitHub Desktop.
Save photonstorm/46cb8fb4b19fc7717dcad514cdcec064 to your computer and use it in GitHub Desktop.

Revisions

  1. photonstorm revised this gist Oct 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion phaser3-example.html
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://labs.phaser.io/build/phaser-arcade-physics.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser-arcade-physics.min.js"></script>
    </head>
    <body>

  2. photonstorm created this gist Feb 13, 2018.
    59 changes: 59 additions & 0 deletions phaser3-example.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://labs.phaser.io/build/phaser-arcade-physics.min.js"></script>
    </head>
    <body>

    <script>
    var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    physics: {
    default: 'arcade',
    arcade: {
    gravity: { y: 200 }
    }
    },
    scene: {
    preload: preload,
    create: create
    }
    };

    var game = new Phaser.Game(config);

    function preload ()
    {
    this.load.setBaseURL('http://labs.phaser.io');

    this.load.image('sky', 'assets/skies/space3.png');
    this.load.image('logo', 'assets/sprites/phaser3-logo.png');
    this.load.image('red', 'assets/particles/red.png');
    }

    function create ()
    {
    this.add.image(400, 300, 'sky');

    var particles = this.add.particles('red');

    var emitter = particles.createEmitter({
    speed: 100,
    scale: { start: 1, end: 0 },
    blendMode: 'ADD'
    });

    var logo = this.physics.add.image(400, 100, 'logo');

    logo.setVelocity(100, 200);
    logo.setBounce(1, 1);
    logo.setCollideWorldBounds(true);

    emitter.startFollow(logo);
    }
    </script>

    </body>
    </html>