1+ <!DOCTYPE HTML>
2+ <html>
3+ <head>
4+ <title>phaser.js - a new beginning</title>
5+ <?php
6+ require ('js.php ' );
7+ ?>
8+ </head>
9+ <body>
10+
11+ <script type="text/javascript">
12+
13+ (function () {
14+
15+ var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
16+
17+ var p;
18+
19+ function preload() {
20+
21+ game.load.image('carrot', 'assets/sprites/carrot.png');
22+ game.load.image('star', 'assets/misc/star_particle.png');
23+ game.load.image('diamond', 'assets/sprites/diamond.png');
24+ game.load.image('dude', 'assets/sprites/phaser-dude.png');
25+ game.load.image('coke', 'assets/sprites/cokecan.png');
26+
27+ }
28+
29+ function create() {
30+
31+ p = new Phaser.Particles.Arcade.Emitter(game, 200, 100, 500);
32+
33+ // p.width = 200;
34+ // p.height = 200;
35+
36+ p.makeParticles('diamond');
37+
38+ // Steady constant stream at 250ms delay and 10 seconds lifespan
39+ // p.start(false, 10000, 250, 100);
40+
41+ // p.start(true, 10000);
42+
43+ // explode, lifespan, frequency, quantity
44+ p.minParticleSpeed.setTo(-100, -100);
45+ p.maxParticleSpeed.setTo(100, -200);
46+ p.gravity = 10;
47+ p.start(false, 3000, 10);
48+
49+ game.add.tween(p).to({ emitX: 400 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
50+
51+ }
52+
53+ function update() {
54+
55+ p.update();
56+
57+ }
58+
59+ function render() {
60+ }
61+
62+ })();
63+ </script>
64+
65+ </body>
66+ </html>
0 commit comments