SNT

Cours de SNT
git clone git://git.vgx.fr/SNT
Log | Files | Refs

test.html (1305B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4     <script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser-arcade-physics.min.js"></script>
      5 </head>
      6 <body>
      7 
      8     <button onclick='left();'>lol</button>
      9     <script>
     10     var config = {
     11         type: Phaser.AUTO,
     12         width: 800,
     13         height: 600,
     14         physics: {
     15             default: 'arcade',
     16             arcade: {
     17                 gravity: { y: 200 }
     18             }
     19         },
     20         scene: {
     21             preload: preload,
     22             create: create
     23         }
     24     };
     25 
     26     var game = new Phaser.Game(config);
     27     var logo;
     28 
     29     function preload ()
     30     {
     31         this.load.setBaseURL('http://labs.phaser.io');
     32 
     33         this.load.image('sky', 'assets/skies/space3.png');
     34         this.load.image('logo', 'assets/sprites/phaser3-logo.png');
     35         this.load.image('red', 'assets/particles/red.png');
     36     }
     37 
     38     function create ()
     39     {
     40         this.add.image(400, 300, 'sky');
     41 
     42         var particles = this.add.particles('red');
     43 
     44         var emitter = particles.createEmitter({
     45             speed: 100,
     46             scale: { start: 1, end: 0 },
     47             blendMode: 'ADD'
     48         });
     49 
     50         logo = this.add.image(400, 100, 'logo');
     51 
     52         emitter.startFollow(logo);
     53     }
     54 
     55     function left() {
     56         logo.x += 50;
     57     }
     58     </script>
     59 
     60 </body>
     61 </html>